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
|
@Override
|
||||||
public int compareTo(ContainerId other) {
|
public int compareTo(ContainerId other) {
|
||||||
if (this.getApplicationAttemptId().compareTo(
|
int result = this.getApplicationAttemptId().compareTo(
|
||||||
other.getApplicationAttemptId()) == 0) {
|
other.getApplicationAttemptId());
|
||||||
return Long.valueOf(getContainerId())
|
if (result == 0) {
|
||||||
.compareTo(Long.valueOf(other.getContainerId()));
|
return Long.compare(getContainerId(), other.getContainerId());
|
||||||
} else {
|
} else {
|
||||||
return this.getApplicationAttemptId().compareTo(
|
return result;
|
||||||
other.getApplicationAttemptId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ public class TopCLI extends YarnCLI {
|
||||||
@Override
|
@Override
|
||||||
public int
|
public int
|
||||||
compare(ApplicationInformation a1, ApplicationInformation a2) {
|
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 =
|
public static final Comparator<ApplicationInformation> ReservedMemoryComparator =
|
||||||
|
@ -249,7 +249,7 @@ public class TopCLI extends YarnCLI {
|
||||||
@Override
|
@Override
|
||||||
public int
|
public int
|
||||||
compare(ApplicationInformation a1, ApplicationInformation a2) {
|
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 =
|
public static final Comparator<ApplicationInformation> UsedVCoresComparator =
|
||||||
|
@ -273,7 +273,7 @@ public class TopCLI extends YarnCLI {
|
||||||
@Override
|
@Override
|
||||||
public int
|
public int
|
||||||
compare(ApplicationInformation a1, ApplicationInformation a2) {
|
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 =
|
public static final Comparator<ApplicationInformation> MemorySecondsComparator =
|
||||||
|
@ -281,7 +281,7 @@ public class TopCLI extends YarnCLI {
|
||||||
@Override
|
@Override
|
||||||
public int
|
public int
|
||||||
compare(ApplicationInformation a1, ApplicationInformation a2) {
|
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 =
|
public static final Comparator<ApplicationInformation> ProgressComparator =
|
||||||
|
@ -297,7 +297,7 @@ public class TopCLI extends YarnCLI {
|
||||||
@Override
|
@Override
|
||||||
public int
|
public int
|
||||||
compare(ApplicationInformation a1, ApplicationInformation a2) {
|
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 =
|
public static final Comparator<ApplicationInformation> AppNameComparator =
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class TestYarnConfiguration {
|
||||||
String rmWebUrl = WebAppUtils.getRMWebAppURLWithScheme(conf);
|
String rmWebUrl = WebAppUtils.getRMWebAppURLWithScheme(conf);
|
||||||
String[] parts = rmWebUrl.split(":");
|
String[] parts = rmWebUrl.split(":");
|
||||||
Assert.assertEquals("RM Web URL Port is incrrect", 24543,
|
Assert.assertEquals("RM Web URL Port is incrrect", 24543,
|
||||||
Integer.valueOf(parts[parts.length - 1]).intValue());
|
Integer.parseInt(parts[parts.length - 1]));
|
||||||
Assert.assertNotSame(
|
Assert.assertNotSame(
|
||||||
"RM Web Url not resolved correctly. Should not be rmtesting",
|
"RM Web Url not resolved correctly. Should not be rmtesting",
|
||||||
"http://rmtesting:24543", rmWebUrl);
|
"http://rmtesting:24543", rmWebUrl);
|
||||||
|
@ -178,7 +178,7 @@ public class TestYarnConfiguration {
|
||||||
conf.set(YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS, "yo.yo.yo");
|
conf.set(YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS, "yo.yo.yo");
|
||||||
serverAddress = new InetSocketAddress(
|
serverAddress = new InetSocketAddress(
|
||||||
YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS.split(":")[0],
|
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(
|
resourceTrackerConnectAddress = conf.updateConnectAddr(
|
||||||
YarnConfiguration.RM_BIND_HOST,
|
YarnConfiguration.RM_BIND_HOST,
|
||||||
|
@ -194,7 +194,7 @@ public class TestYarnConfiguration {
|
||||||
conf.set(YarnConfiguration.RM_BIND_HOST, "0.0.0.0");
|
conf.set(YarnConfiguration.RM_BIND_HOST, "0.0.0.0");
|
||||||
serverAddress = new InetSocketAddress(
|
serverAddress = new InetSocketAddress(
|
||||||
YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS.split(":")[0],
|
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(
|
resourceTrackerConnectAddress = conf.updateConnectAddr(
|
||||||
YarnConfiguration.RM_BIND_HOST,
|
YarnConfiguration.RM_BIND_HOST,
|
||||||
|
@ -213,7 +213,7 @@ public class TestYarnConfiguration {
|
||||||
|
|
||||||
serverAddress = new InetSocketAddress(
|
serverAddress = new InetSocketAddress(
|
||||||
YarnConfiguration.DEFAULT_NM_LOCALIZER_ADDRESS.split(":")[0],
|
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(
|
InetSocketAddress localizerAddress = conf.updateConnectAddr(
|
||||||
YarnConfiguration.NM_BIND_HOST,
|
YarnConfiguration.NM_BIND_HOST,
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class NodeLabelTestBase {
|
||||||
int idx = str.indexOf(':');
|
int idx = str.indexOf(':');
|
||||||
NodeId id =
|
NodeId id =
|
||||||
NodeId.newInstance(str.substring(0, idx),
|
NodeId.newInstance(str.substring(0, idx),
|
||||||
Integer.valueOf(str.substring(idx + 1)));
|
Integer.parseInt(str.substring(idx + 1)));
|
||||||
return id;
|
return id;
|
||||||
} else {
|
} else {
|
||||||
return NodeId.newInstance(str, CommonNodeLabelsManager.WILDCARD_PORT);
|
return NodeId.newInstance(str, CommonNodeLabelsManager.WILDCARD_PORT);
|
||||||
|
|
|
@ -431,7 +431,7 @@ public class TestFSDownload {
|
||||||
try {
|
try {
|
||||||
for (Map.Entry<LocalResource,Future<Path>> p : pending.entrySet()) {
|
for (Map.Entry<LocalResource,Future<Path>> p : pending.entrySet()) {
|
||||||
Path localized = p.getValue().get();
|
Path localized = p.getValue().get();
|
||||||
assertEquals(sizes[Integer.valueOf(localized.getName())], p.getKey()
|
assertEquals(sizes[Integer.parseInt(localized.getName())], p.getKey()
|
||||||
.getSize());
|
.getSize());
|
||||||
|
|
||||||
FileStatus status = files.getFileStatus(localized.getParent());
|
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.
|
* @return true if the SASL client system property is set.
|
||||||
*/
|
*/
|
||||||
public static boolean isClientSASLEnabled() {
|
public static boolean isClientSASLEnabled() {
|
||||||
return Boolean.valueOf(System.getProperty(
|
return Boolean.parseBoolean(System.getProperty(
|
||||||
ZookeeperConfigOptions.PROP_ZK_ENABLE_SASL_CLIENT, "true"));
|
ZookeeperConfigOptions.PROP_ZK_ENABLE_SASL_CLIENT, "true"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,7 +862,7 @@ public class RegistrySecurity extends AbstractService {
|
||||||
String sasl =
|
String sasl =
|
||||||
System.getProperty(PROP_ZK_ENABLE_SASL_CLIENT,
|
System.getProperty(PROP_ZK_ENABLE_SASL_CLIENT,
|
||||||
DEFAULT_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,
|
builder.append(describeProperty(PROP_ZK_ENABLE_SASL_CLIENT,
|
||||||
DEFAULT_ZK_ENABLE_SASL_CLIENT));
|
DEFAULT_ZK_ENABLE_SASL_CLIENT));
|
||||||
if (saslEnabled) {
|
if (saslEnabled) {
|
||||||
|
|
|
@ -1017,7 +1017,7 @@ public class ContainerLaunch implements Callable<Integer> {
|
||||||
//variable can be set to indicate that distcache entries should come
|
//variable can be set to indicate that distcache entries should come
|
||||||
//first
|
//first
|
||||||
|
|
||||||
boolean preferLocalizedJars = Boolean.valueOf(
|
boolean preferLocalizedJars = Boolean.parseBoolean(
|
||||||
environment.get(Environment.CLASSPATH_PREPEND_DISTCACHE.name())
|
environment.get(Environment.CLASSPATH_PREPEND_DISTCACHE.name())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class ProcessIdFileReader {
|
||||||
else {
|
else {
|
||||||
// Otherwise, find first line containing a numeric pid.
|
// Otherwise, find first line containing a numeric pid.
|
||||||
try {
|
try {
|
||||||
Long pid = Long.valueOf(temp);
|
long pid = Long.parseLong(temp);
|
||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
processId = temp;
|
processId = temp;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -89,7 +89,8 @@ public class FairOrderingPolicy<S extends SchedulableEntity> extends AbstractCom
|
||||||
@Override
|
@Override
|
||||||
public void configure(Map<String, String> conf) {
|
public void configure(Map<String, String> conf) {
|
||||||
if (conf.containsKey(ENABLE_SIZE_BASED_WEIGHT)) {
|
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++) {
|
for (int i = 0; i < resData.length; i++) {
|
||||||
String[] resource = resData[i].split(":");
|
String[] resource = resData[i].split(":");
|
||||||
if (resource.length == 1) {
|
if (resource.length == 1) {
|
||||||
resourceList.add(Resource.newInstance(Integer.valueOf(resource[0]), 0));
|
resourceList.add(Resource.newInstance(Integer.parseInt(resource[0]), 0));
|
||||||
} else {
|
} else {
|
||||||
resourceList.add(Resource.newInstance(Integer.valueOf(resource[0]),
|
resourceList.add(Resource.newInstance(Integer.parseInt(resource[0]),
|
||||||
Integer.valueOf(resource[1])));
|
Integer.parseInt(resource[1])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resourceList.toArray(new Resource[resourceList.size()]);
|
return resourceList.toArray(new Resource[resourceList.size()]);
|
||||||
|
|
|
@ -929,12 +929,12 @@ public class TestProportionalCapacityPreemptionPolicyForNodePartitions {
|
||||||
throw new IllegalArgumentException("Format to define container is:"
|
throw new IllegalArgumentException("Format to define container is:"
|
||||||
+ "(priority,resource,host,expression,repeat,reserved)");
|
+ "(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]);
|
Resource res = parseResourceFromString(values[1]);
|
||||||
NodeId host = NodeId.newInstance(values[2], 1);
|
NodeId host = NodeId.newInstance(values[2], 1);
|
||||||
String exp = values[3];
|
String exp = values[3];
|
||||||
int repeat = Integer.valueOf(values[4]);
|
int repeat = Integer.parseInt(values[4]);
|
||||||
boolean reserved = Boolean.valueOf(values[5]);
|
boolean reserved = Boolean.parseBoolean(values[5]);
|
||||||
|
|
||||||
for (int i = 0; i < repeat; i++) {
|
for (int i = 0; i < repeat; i++) {
|
||||||
Container c = mock(Container.class);
|
Container c = mock(Container.class);
|
||||||
|
@ -1068,7 +1068,7 @@ public class TestProportionalCapacityPreemptionPolicyForNodePartitions {
|
||||||
Resource res = parseResourceFromString(p.substring(p.indexOf("=") + 1,
|
Resource res = parseResourceFromString(p.substring(p.indexOf("=") + 1,
|
||||||
p.indexOf(",")));
|
p.indexOf(",")));
|
||||||
boolean exclusivity =
|
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)))
|
when(nlm.getResourceByLabel(eq(partitionName), any(Resource.class)))
|
||||||
.thenReturn(res);
|
.thenReturn(res);
|
||||||
when(nlm.isExclusiveNodeLabel(eq(partitionName))).thenReturn(exclusivity);
|
when(nlm.isExclusiveNodeLabel(eq(partitionName))).thenReturn(exclusivity);
|
||||||
|
@ -1088,10 +1088,10 @@ public class TestProportionalCapacityPreemptionPolicyForNodePartitions {
|
||||||
String[] resource = p.split(":");
|
String[] resource = p.split(":");
|
||||||
Resource res = Resources.createResource(0);
|
Resource res = Resources.createResource(0);
|
||||||
if (resource.length == 1) {
|
if (resource.length == 1) {
|
||||||
res = Resources.createResource(Integer.valueOf(resource[0]));
|
res = Resources.createResource(Integer.parseInt(resource[0]));
|
||||||
} else {
|
} else {
|
||||||
res = Resources.createResource(Integer.valueOf(resource[0]),
|
res = Resources.createResource(Integer.parseInt(resource[0]),
|
||||||
Integer.valueOf(resource[1]));
|
Integer.parseInt(resource[1]));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,7 +310,7 @@ public class WebAppProxyServlet extends HttpServlet {
|
||||||
String userApprovedParamS =
|
String userApprovedParamS =
|
||||||
req.getParameter(ProxyUriUtils.PROXY_APPROVAL_PARAM);
|
req.getParameter(ProxyUriUtils.PROXY_APPROVAL_PARAM);
|
||||||
boolean userWasWarned = false;
|
boolean userWasWarned = false;
|
||||||
boolean userApproved = Boolean.valueOf(userApprovedParamS);
|
boolean userApproved = Boolean.parseBoolean(userApprovedParamS);
|
||||||
boolean securityEnabled = isSecurityEnabled();
|
boolean securityEnabled = isSecurityEnabled();
|
||||||
final String remoteUser = req.getRemoteUser();
|
final String remoteUser = req.getRemoteUser();
|
||||||
final String pathInfo = req.getPathInfo();
|
final String pathInfo = req.getPathInfo();
|
||||||
|
@ -342,7 +342,7 @@ public class WebAppProxyServlet extends HttpServlet {
|
||||||
for (Cookie c : cookies) {
|
for (Cookie c : cookies) {
|
||||||
if (cookieName.equals(c.getName())) {
|
if (cookieName.equals(c.getName())) {
|
||||||
userWasWarned = true;
|
userWasWarned = true;
|
||||||
userApproved = userApproved || Boolean.valueOf(c.getValue());
|
userApproved = userApproved || Boolean.parseBoolean(c.getValue());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue