diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java index c9b96181ad8..f332651daf2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java @@ -165,13 +165,12 @@ public abstract class ContainerId implements Comparable{ @Override public int compareTo(ContainerId other) { - if (this.getApplicationAttemptId().compareTo( - other.getApplicationAttemptId()) == 0) { - return Long.valueOf(getContainerId()) - .compareTo(Long.valueOf(other.getContainerId())); + int result = this.getApplicationAttemptId().compareTo( + other.getApplicationAttemptId()); + if (result == 0) { + return Long.compare(getContainerId(), other.getContainerId()); } else { - return this.getApplicationAttemptId().compareTo( - other.getApplicationAttemptId()); + return result; } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/TopCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/TopCLI.java index 8bcbcf3eb90..79d451a52f6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/TopCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/TopCLI.java @@ -238,7 +238,7 @@ public class TopCLI extends YarnCLI { @Override public int compare(ApplicationInformation a1, ApplicationInformation a2) { - return Long.valueOf(a1.usedMemory).compareTo(a2.usedMemory); + return Long.compare(a1.usedMemory, a2.usedMemory); } }; public static final Comparator ReservedMemoryComparator = @@ -246,7 +246,7 @@ public class TopCLI extends YarnCLI { @Override public int compare(ApplicationInformation a1, ApplicationInformation a2) { - return Long.valueOf(a1.reservedMemory).compareTo(a2.reservedMemory); + return Long.compare(a1.reservedMemory, a2.reservedMemory); } }; public static final Comparator UsedVCoresComparator = @@ -270,7 +270,7 @@ public class TopCLI extends YarnCLI { @Override public int compare(ApplicationInformation a1, ApplicationInformation a2) { - return Long.valueOf(a1.vcoreSeconds).compareTo(a2.vcoreSeconds); + return Long.compare(a1.vcoreSeconds, a2.vcoreSeconds); } }; public static final Comparator MemorySecondsComparator = @@ -278,7 +278,7 @@ public class TopCLI extends YarnCLI { @Override public int compare(ApplicationInformation a1, ApplicationInformation a2) { - return Long.valueOf(a1.memorySeconds).compareTo(a2.memorySeconds); + return Long.compare(a1.memorySeconds, a2.memorySeconds); } }; public static final Comparator ProgressComparator = @@ -294,7 +294,7 @@ public class TopCLI extends YarnCLI { @Override public int compare(ApplicationInformation a1, ApplicationInformation a2) { - return Long.valueOf(a1.runningTime).compareTo(a2.runningTime); + return Long.compare(a1.runningTime, a2.runningTime); } }; public static final Comparator AppNameComparator = diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfiguration.java index 1f10810494e..2e76865ec7f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfiguration.java @@ -54,7 +54,7 @@ public class TestYarnConfiguration { String rmWebUrl = WebAppUtils.getRMWebAppURLWithScheme(conf); String[] parts = rmWebUrl.split(":"); Assert.assertEquals("RM Web URL Port is incrrect", 24543, - Integer.valueOf(parts[parts.length - 1]).intValue()); + Integer.parseInt(parts[parts.length - 1])); Assert.assertNotSame( "RM Web Url not resolved correctly. Should not be rmtesting", "http://rmtesting:24543", rmWebUrl); @@ -178,7 +178,7 @@ public class TestYarnConfiguration { conf.set(YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS, "yo.yo.yo"); serverAddress = new InetSocketAddress( YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS.split(":")[0], - Integer.valueOf(YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS.split(":")[1])); + Integer.parseInt(YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS.split(":")[1])); resourceTrackerConnectAddress = conf.updateConnectAddr( YarnConfiguration.RM_BIND_HOST, @@ -194,7 +194,7 @@ public class TestYarnConfiguration { conf.set(YarnConfiguration.RM_BIND_HOST, "0.0.0.0"); serverAddress = new InetSocketAddress( YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS.split(":")[0], - Integer.valueOf(YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS.split(":")[1])); + Integer.parseInt(YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS.split(":")[1])); resourceTrackerConnectAddress = conf.updateConnectAddr( YarnConfiguration.RM_BIND_HOST, @@ -213,7 +213,7 @@ public class TestYarnConfiguration { serverAddress = new InetSocketAddress( YarnConfiguration.DEFAULT_NM_LOCALIZER_ADDRESS.split(":")[0], - Integer.valueOf(YarnConfiguration.DEFAULT_NM_LOCALIZER_ADDRESS.split(":")[1])); + Integer.parseInt(YarnConfiguration.DEFAULT_NM_LOCALIZER_ADDRESS.split(":")[1])); InetSocketAddress localizerAddress = conf.updateConnectAddr( YarnConfiguration.NM_BIND_HOST, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/NodeLabelTestBase.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/NodeLabelTestBase.java index 1f64e5074fa..28b9497fa36 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/NodeLabelTestBase.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/nodelabels/NodeLabelTestBase.java @@ -140,7 +140,7 @@ public class NodeLabelTestBase { int idx = str.indexOf(':'); NodeId id = NodeId.newInstance(str.substring(0, idx), - Integer.valueOf(str.substring(idx + 1))); + Integer.parseInt(str.substring(idx + 1))); return id; } else { return NodeId.newInstance(str, CommonNodeLabelsManager.WILDCARD_PORT); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java index 3597b314715..1125b1ed0c3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java @@ -431,7 +431,7 @@ public class TestFSDownload { try { for (Map.Entry> p : pending.entrySet()) { Path localized = p.getValue().get(); - assertEquals(sizes[Integer.valueOf(localized.getName())], p.getKey() + assertEquals(sizes[Integer.parseInt(localized.getName())], p.getKey() .getSize()); FileStatus status = files.getFileStatus(localized.getParent()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/RegistrySecurity.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/RegistrySecurity.java index 1c75e43987e..fc614600d2f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/RegistrySecurity.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/RegistrySecurity.java @@ -772,7 +772,7 @@ public class RegistrySecurity extends AbstractService { * @return true if the SASL client system property is set. */ public static boolean isClientSASLEnabled() { - return Boolean.valueOf(System.getProperty( + return Boolean.parseBoolean(System.getProperty( ZookeeperConfigOptions.PROP_ZK_ENABLE_SASL_CLIENT, "true")); } @@ -862,7 +862,7 @@ public class RegistrySecurity extends AbstractService { String sasl = System.getProperty(PROP_ZK_ENABLE_SASL_CLIENT, DEFAULT_ZK_ENABLE_SASL_CLIENT); - boolean saslEnabled = Boolean.valueOf(sasl); + boolean saslEnabled = Boolean.parseBoolean(sasl); builder.append(describeProperty(PROP_ZK_ENABLE_SASL_CLIENT, DEFAULT_ZK_ENABLE_SASL_CLIENT)); if (saslEnabled) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java index b7a97d6b1c4..5bdfe12388b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java @@ -927,7 +927,7 @@ public class ContainerLaunch implements Callable { //variable can be set to indicate that distcache entries should come //first - boolean preferLocalizedJars = Boolean.valueOf( + boolean preferLocalizedJars = Boolean.parseBoolean( environment.get(Environment.CLASSPATH_PREPEND_DISTCACHE.name()) ); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/util/ProcessIdFileReader.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/util/ProcessIdFileReader.java index 52fcdec020e..80d4db24988 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/util/ProcessIdFileReader.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/util/ProcessIdFileReader.java @@ -79,7 +79,7 @@ public class ProcessIdFileReader { else { // Otherwise, find first line containing a numeric pid. try { - Long pid = Long.valueOf(temp); + long pid = Long.parseLong(temp); if (pid > 0) { processId = temp; break; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/FairOrderingPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/FairOrderingPolicy.java index ea14b426753..04cd53afd0e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/FairOrderingPolicy.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/policy/FairOrderingPolicy.java @@ -89,7 +89,8 @@ public class FairOrderingPolicy extends AbstractCom @Override public void configure(Map conf) { if (conf.containsKey(ENABLE_SIZE_BASED_WEIGHT)) { - sizeBasedWeight = Boolean.valueOf(conf.get(ENABLE_SIZE_BASED_WEIGHT)); + sizeBasedWeight = + Boolean.parseBoolean(conf.get(ENABLE_SIZE_BASED_WEIGHT)); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicy.java index 13f267d8b29..a71fa39bd8c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicy.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicy.java @@ -1029,10 +1029,10 @@ public class TestProportionalCapacityPreemptionPolicy { for (int i = 0; i < resData.length; i++) { String[] resource = resData[i].split(":"); if (resource.length == 1) { - resourceList.add(Resource.newInstance(Integer.valueOf(resource[0]), 0)); + resourceList.add(Resource.newInstance(Integer.parseInt(resource[0]), 0)); } else { - resourceList.add(Resource.newInstance(Integer.valueOf(resource[0]), - Integer.valueOf(resource[1]))); + resourceList.add(Resource.newInstance(Integer.parseInt(resource[0]), + Integer.parseInt(resource[1]))); } } return resourceList.toArray(new Resource[resourceList.size()]); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicyForNodePartitions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicyForNodePartitions.java index 512f37c292c..5929c3d1f52 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicyForNodePartitions.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/TestProportionalCapacityPreemptionPolicyForNodePartitions.java @@ -935,12 +935,12 @@ public class TestProportionalCapacityPreemptionPolicyForNodePartitions { throw new IllegalArgumentException("Format to define container is:" + "(priority,resource,host,expression,repeat,reserved)"); } - Priority pri = Priority.newInstance(Integer.valueOf(values[0])); + Priority pri = Priority.newInstance(Integer.parseInt(values[0])); Resource res = parseResourceFromString(values[1]); NodeId host = NodeId.newInstance(values[2], 1); String exp = values[3]; - int repeat = Integer.valueOf(values[4]); - boolean reserved = Boolean.valueOf(values[5]); + int repeat = Integer.parseInt(values[4]); + boolean reserved = Boolean.parseBoolean(values[5]); for (int i = 0; i < repeat; i++) { Container c = mock(Container.class); @@ -1074,7 +1074,7 @@ public class TestProportionalCapacityPreemptionPolicyForNodePartitions { Resource res = parseResourceFromString(p.substring(p.indexOf("=") + 1, p.indexOf(","))); boolean exclusivity = - Boolean.valueOf(p.substring(p.indexOf(",") + 1, p.length())); + Boolean.parseBoolean(p.substring(p.indexOf(",") + 1, p.length())); when(nlm.getResourceByLabel(eq(partitionName), any(Resource.class))) .thenReturn(res); when(nlm.isExclusiveNodeLabel(eq(partitionName))).thenReturn(exclusivity); @@ -1094,10 +1094,10 @@ public class TestProportionalCapacityPreemptionPolicyForNodePartitions { String[] resource = p.split(":"); Resource res = Resources.createResource(0); if (resource.length == 1) { - res = Resources.createResource(Integer.valueOf(resource[0])); + res = Resources.createResource(Integer.parseInt(resource[0])); } else { - res = Resources.createResource(Integer.valueOf(resource[0]), - Integer.valueOf(resource[1])); + res = Resources.createResource(Integer.parseInt(resource[0]), + Integer.parseInt(resource[1])); } return res; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java index ab4b2956e9c..9d64667b4c9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java @@ -310,7 +310,7 @@ public class WebAppProxyServlet extends HttpServlet { String userApprovedParamS = req.getParameter(ProxyUriUtils.PROXY_APPROVAL_PARAM); boolean userWasWarned = false; - boolean userApproved = Boolean.valueOf(userApprovedParamS); + boolean userApproved = Boolean.parseBoolean(userApprovedParamS); boolean securityEnabled = isSecurityEnabled(); final String remoteUser = req.getRemoteUser(); final String pathInfo = req.getPathInfo(); @@ -342,7 +342,7 @@ public class WebAppProxyServlet extends HttpServlet { for (Cookie c : cookies) { if (cookieName.equals(c.getName())) { userWasWarned = true; - userApproved = userApproved || Boolean.valueOf(c.getValue()); + userApproved = userApproved || Boolean.parseBoolean(c.getValue()); break; } }