YARN-4630. Remove useless boxing/unboxing code. Contributed by Kousuke Saruta.
This commit is contained in:
parent
07920acc16
commit
1ff27f9d12
|
@ -165,13 +165,12 @@ public abstract class ContainerId implements Comparable<ContainerId>{
|
|||
|
||||
@Override
|
||||
public int compareTo(ContainerId other) {
|
||||
if (this.getApplicationAttemptId().compareTo(
|
||||
other.getApplicationAttemptId()) == 0) {
|
||||
return Long.valueOf(getContainerId())
|
||||
.compareTo(Long.valueOf(other.getContainerId()));
|
||||
} else {
|
||||
return this.getApplicationAttemptId().compareTo(
|
||||
int result = this.getApplicationAttemptId().compareTo(
|
||||
other.getApplicationAttemptId());
|
||||
if (result == 0) {
|
||||
return Long.compare(getContainerId(), other.getContainerId());
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -241,7 +241,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<ApplicationInformation> ReservedMemoryComparator =
|
||||
|
@ -249,7 +249,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<ApplicationInformation> UsedVCoresComparator =
|
||||
|
@ -273,7 +273,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<ApplicationInformation> MemorySecondsComparator =
|
||||
|
@ -281,7 +281,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<ApplicationInformation> ProgressComparator =
|
||||
|
@ -297,7 +297,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<ApplicationInformation> AppNameComparator =
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -431,7 +431,7 @@ public class TestFSDownload {
|
|||
try {
|
||||
for (Map.Entry<LocalResource,Future<Path>> 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());
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1017,7 +1017,7 @@ public class ContainerLaunch implements Callable<Integer> {
|
|||
//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())
|
||||
);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -89,7 +89,8 @@ public class FairOrderingPolicy<S extends SchedulableEntity> extends AbstractCom
|
|||
@Override
|
||||
public void configure(Map<String, String> 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1032,10 +1032,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()]);
|
||||
|
|
|
@ -929,12 +929,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);
|
||||
|
@ -1068,7 +1068,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);
|
||||
|
@ -1088,10 +1088,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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue