Skip to content

Commit ce5ca51

Browse files
author
slfan1989
committed
YARN-10885. Fix CheckStyle.
1 parent f6096e2 commit ce5ca51

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/utils/FederationStateStoreFacade.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,11 @@ public SubClusterId getApplicationHomeSubCluster(ApplicationId appId)
381381
try {
382382
if (isCachingEnabled()) {
383383
Object value =
384-
cache.get(buildGetApplicationHomeSubClusterRequest(appId.toString()));
385-
if(value instanceof SubClusterId){
384+
cache.get(buildGetApplicationHomeSubClusterRequest(appId));
385+
if (value instanceof SubClusterId) {
386386
return (SubClusterId) value;
387387
} else {
388-
throw new YarnException("Cannot be converted to a map.");
388+
throw new YarnException("Cannot be converted to SubClusterId.");
389389
}
390390
} else {
391391
GetApplicationHomeSubClusterResponse response = stateStore.getApplicationHomeSubCluster(
@@ -528,15 +528,13 @@ public Map<String, SubClusterPolicyConfiguration> invoke(
528528
return cacheRequest;
529529
}
530530

531-
private Object buildGetApplicationHomeSubClusterRequest(String appId) {
531+
private Object buildGetApplicationHomeSubClusterRequest(ApplicationId applicationId) {
532532
final String cacheKey = buildCacheKey(getClass().getSimpleName(),
533-
GET_APPLICATION_HOME_SUBCLUSTER_CACHEID, appId);
533+
GET_APPLICATION_HOME_SUBCLUSTER_CACHEID, applicationId.toString());
534534
CacheRequest<String, SubClusterId> cacheRequest =
535535
new CacheRequest<>(
536536
cacheKey,
537537
input -> {
538-
ApplicationId applicationId = ApplicationId.fromString(appId);
539-
540538
GetApplicationHomeSubClusterResponse response =
541539
stateStore.getApplicationHomeSubCluster(
542540
GetApplicationHomeSubClusterRequest.newInstance(applicationId));
@@ -653,7 +651,7 @@ public Cache<Object, Object> getCache() {
653651
}
654652

655653
@VisibleForTesting
656-
protected Object getAppHomeSubClusterCacheRequest(String appId) {
657-
return buildGetApplicationHomeSubClusterRequest(appId);
654+
protected Object getAppHomeSubClusterCacheRequest(ApplicationId applicationId) {
655+
return buildGetApplicationHomeSubClusterRequest(applicationId);
658656
}
659657
}

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/utils/TestFederationStateStoreFacade.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public void testGetApplicationHomeSubClusterCache() throws YarnException {
226226

227227
if (isCachingEnabled.booleanValue()) {
228228
Cache<Object, Object> cache = facade.getCache();
229-
Object cacheKey = facade.getAppHomeSubClusterCacheRequest(appId.toString());
229+
Object cacheKey = facade.getAppHomeSubClusterCacheRequest(appId);
230230
Object subClusterIdByCache = cache.get(cacheKey);
231231
Assert.assertEquals(subClusterIdByFacade, subClusterIdByCache);
232232
Assert.assertEquals(subClusterId1, subClusterIdByCache);

0 commit comments

Comments
 (0)