Skip to content

Commit b922933

Browse files
author
slfan1989
committed
YARN-11350. Fix CheckStyle.
1 parent f192288 commit b922933

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/FederationDelegationTokenStateStore.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ RouterRMTokenResponse getTokenByRouterStoreToken(RouterRMTokenRequest request)
114114
throws YarnException, IOException;
115115

116116
/**
117+
* The Router Supports incrementDelegationTokenSeqNum.
117118
*
118-
* @return
119+
* @return DelegationTokenSeqNum.
119120
*/
120121
int incrementDelegationTokenSeqNum();
121122
}

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ public void init(Configuration conf) throws YarnException {
240240
zkManager.createRootDirRecursively(routerRMDTSecretManagerRoot, zkAcl);
241241
zkManager.createRootDirRecursively(routerRMDTMasterKeysRootPath, zkAcl);
242242
zkManager.createRootDirRecursively(routerRMDelegationTokensRootPath, zkAcl);
243-
// zkManager.createRootDirRecursively(routerRMSequenceNumberPath, zkAcl);
244243
} catch (Exception e) {
245244
String errMsg = "Cannot create base directories: " + e.getMessage();
246245
FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg);
247246
}
248247

248+
// Distributed sequenceNum.
249249
try {
250250
seqNumBatchSize = conf.getInt(ZK_DTSM_TOKEN_SEQNUM_BATCH_SIZE,
251251
ZK_DTSM_TOKEN_SEQNUM_BATCH_SIZE_DEFAULT);
@@ -270,6 +270,15 @@ public void init(Configuration conf) throws YarnException {
270270

271271
@Override
272272
public void close() throws Exception {
273+
274+
try {
275+
if (delTokSeqCounter != null) {
276+
delTokSeqCounter.close();
277+
}
278+
} catch (Exception e) {
279+
LOG.error("Could not Stop Delegation Token Counter", e);
280+
}
281+
273282
if (zkManager != null) {
274283
zkManager.close();
275284
}
@@ -1461,11 +1470,10 @@ public synchronized int incrementDelegationTokenSeqNum() {
14611470
currentSeqNum = incrSharedCount(delTokSeqCounter, seqNumBatchSize);
14621471
currentMaxSeqNum = currentSeqNum + seqNumBatchSize;
14631472
LOG.info("Fetched new range of seq num, from {} to {} ",
1464-
currentSeqNum+1, currentMaxSeqNum);
1473+
currentSeqNum + 1, currentMaxSeqNum);
14651474
} catch (InterruptedException e) {
14661475
// The ExpirationThread is just finishing.. so dont do anything..
1467-
LOG.debug(
1468-
"Thread interrupted while performing token counter increment", e);
1476+
LOG.debug("Thread interrupted while performing token counter increment", e);
14691477
Thread.currentThread().interrupt();
14701478
} catch (Exception e) {
14711479
throw new RuntimeException("Could not increment shared counter !!", e);
@@ -1476,7 +1484,7 @@ public synchronized int incrementDelegationTokenSeqNum() {
14761484
}
14771485

14781486
private int incrSharedCount(SharedCount sharedCount, int batchSize)
1479-
throws Exception {
1487+
throws Exception {
14801488
while (true) {
14811489
// Loop until we successfully increment the counter
14821490
VersionedValue<Integer> versionedValue = sharedCount.getVersionedValue();

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/TestZookeeperFederationStateStore.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import java.io.IOException;
2121

22-
import org.apache.commons.lang3.NotImplementedException;
2322
import org.apache.curator.framework.CuratorFramework;
2423
import org.apache.curator.framework.CuratorFrameworkFactory;
2524
import org.apache.curator.retry.RetryNTimes;
@@ -171,38 +170,30 @@ public void testMetricsInited() throws Exception {
171170
MetricsRecords.assertMetric(record, "UpdateReservationHomeSubClusterNumOps", expectOps);
172171
}
173172

174-
// @Test(expected = NotImplementedException.class)
175173
public void testStoreNewMasterKey() throws Exception {
176174
super.testStoreNewMasterKey();
177175
}
178176

179-
// @Test(expected = NotImplementedException.class)
180177
public void testGetMasterKeyByDelegationKey() throws YarnException, IOException {
181178
super.testGetMasterKeyByDelegationKey();
182179
}
183180

184-
// @Test(expected = NotImplementedException.class)
185181
public void testRemoveStoredMasterKey() throws YarnException, IOException {
186182
super.testRemoveStoredMasterKey();
187183
}
188184

189-
// @Test(expected = NotImplementedException.class)
190185
public void testStoreNewToken() throws IOException, YarnException {
191186
super.testStoreNewToken();
192-
LOG.info("xxxx");
193187
}
194188

195-
// @Test(expected = NotImplementedException.class)
196189
public void testUpdateStoredToken() throws IOException, YarnException {
197190
super.testUpdateStoredToken();
198191
}
199192

200-
// @Test(expected = NotImplementedException.class)
201193
public void testRemoveStoredToken() throws IOException, YarnException {
202194
super.testRemoveStoredToken();
203195
}
204196

205-
// @Test(expected = NotImplementedException.class)
206197
public void testGetTokenByRouterStoreToken() throws IOException, YarnException {
207198
super.testGetTokenByRouterStoreToken();
208199
}

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/federation/FederationStateStoreService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,11 @@ public RouterRMTokenResponse getTokenByRouterStoreToken(RouterRMTokenRequest req
423423
return stateStoreClient.getTokenByRouterStoreToken(request);
424424
}
425425

426+
@Override
427+
public int incrementDelegationTokenSeqNum() {
428+
return stateStoreClient.incrementDelegationTokenSeqNum();
429+
}
430+
426431
/**
427432
* Create a thread that cleans up the app.
428433
* @param stage rm-start/rm-stop.

0 commit comments

Comments
 (0)