Skip to content

Commit 0c088e8

Browse files
author
Melissa You
committed
checkstyle fix
1 parent 8c681fb commit 0c088e8

4 files changed

Lines changed: 27 additions & 19 deletions

File tree

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/ZKDelegationTokenSecretManager.java

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.io.UncheckedIOException;
2727
import java.util.Collections;
2828
import java.util.List;
29-
import java.util.Map;
3029
import java.util.concurrent.atomic.AtomicInteger;
3130
import java.util.stream.Stream;
3231

@@ -285,7 +284,8 @@ public void startThreads() throws IOException {
285284
// by calling the incrSharedCount
286285
currentSeqNum = incrSharedCount(delTokSeqCounter, seqNumBatchSize);
287286
currentMaxSeqNum = currentSeqNum + seqNumBatchSize;
288-
LOG.info("Fetched initial range of seq num, from {} to {} ", currentSeqNum + 1, currentMaxSeqNum);
287+
LOG.info("Fetched initial range of seq num, from {} to {} ",
288+
currentSeqNum + 1, currentMaxSeqNum);
289289
} catch (Exception e) {
290290
throw new IOException("Could not start Sequence Counter", e);
291291
}
@@ -305,14 +305,18 @@ public void startThreads() throws IOException {
305305
}
306306
try {
307307
keyCache = CuratorCache.bridgeBuilder(zkClient, ZK_DTSM_MASTER_KEY_ROOT).build();
308-
CuratorCacheListener keyCacheListener = CuratorCacheListener.builder().forCreatesAndChanges((oldNode, node) -> {
309-
try {
310-
processKeyAddOrUpdate(node.getData());
311-
} catch (IOException e) {
312-
LOG.error("Error while processing Curator keyCacheListener " + "NODE_CREATED / NODE_CHANGED event");
313-
throw new UncheckedIOException(e);
314-
}
315-
}).forDeletes(childData -> processKeyRemoved(childData.getPath())).build();
308+
CuratorCacheListener keyCacheListener = CuratorCacheListener.builder()
309+
.forCreatesAndChanges((oldNode, node) -> {
310+
try {
311+
processKeyAddOrUpdate(node.getData());
312+
} catch (IOException e) {
313+
LOG.error("Error while processing Curator keyCacheListener "
314+
+ "NODE_CREATED / NODE_CHANGED event");
315+
throw new UncheckedIOException(e);
316+
}
317+
})
318+
.forDeletes(childData -> processKeyRemoved(childData.getPath()))
319+
.build();
316320
keyCache.listenable().addListener(keyCacheListener);
317321
keyCache.start();
318322
loadFromZKCache(false);
@@ -323,21 +327,26 @@ public void startThreads() throws IOException {
323327
LOG.info("TokenCache is enabled");
324328
try {
325329
tokenCache = CuratorCache.bridgeBuilder(zkClient, ZK_DTSM_TOKENS_ROOT).build();
326-
CuratorCacheListener tokenCacheListener = CuratorCacheListener.builder().forCreatesAndChanges((oldNode, node) -> {
330+
CuratorCacheListener tokenCacheListener = CuratorCacheListener.builder()
331+
.forCreatesAndChanges((oldNode, node) -> {
327332
try {
328333
processTokenAddOrUpdate(node.getData());
329334
} catch (IOException e) {
330-
LOG.error("Error while processing Curator tokenCacheListener " + "NODE_CREATED / NODE_CHANGED event");
335+
LOG.error("Error while processing Curator tokenCacheListener "
336+
+ "NODE_CREATED / NODE_CHANGED event");
331337
throw new UncheckedIOException(e);
332338
}
333-
}).forDeletes(childData -> {
339+
})
340+
.forDeletes(childData -> {
334341
try {
335342
processTokenRemoved(childData);
336343
} catch (IOException e) {
337-
LOG.error("Error while processing Curator tokenCacheListener " + "NODE_DELETED event");
344+
LOG.error("Error while processing Curator tokenCacheListener "
345+
+ "NODE_DELETED event");
338346
throw new UncheckedIOException(e);
339347
}
340-
}).build();
348+
})
349+
.build();
341350
tokenCache.listenable().addListener(tokenCacheListener);
342351
tokenCache.start();
343352
loadFromZKCache(true);

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/ClientBaseWithFixes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ protected void stopServer() throws Exception {
436436

437437

438438
protected static ZooKeeperServer getServer(ServerCnxnFactory fac) {
439-
return fac.getZooKeeperServer();
439+
return fac.getZooKeeperServer();
440440
}
441441

442442
protected void tearDownAll() throws Exception {

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/security/token/ZKDelegationTokenSecretManagerImpl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
import org.slf4j.LoggerFactory;
3131
import org.apache.hadoop.conf.Configuration;
3232

33-
import java.io.ByteArrayInputStream;
34-
import java.io.DataInputStream;
3533
import java.io.IOException;
3634
import java.util.HashSet;
3735
import java.util.List;
@@ -193,7 +191,7 @@ private void rebuildTokenCache(boolean initial) throws IOException {
193191
// 2) remove tokens in local cache but not in zk anymore
194192
for (AbstractDelegationTokenIdentifier ident : currentTokens.keySet()) {
195193
if (!localTokenCache.contains(ident)) {
196-
currentTokens.remove(ident);
194+
currentTokens.remove(ident);
197195
}
198196
}
199197
}

hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/security/token/TestZKDelegationTokenSecretManagerImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public void testMultiNodeTokenRemovalShortSyncWithoutWatch()
162162

163163
// This is very unlikely to happen in real case, but worth putting
164164
// the case out
165+
@SuppressWarnings("unchecked")
165166
@Test
166167
public void testMultiNodeTokenRemovalLongSyncWithoutWatch()
167168
throws Exception {

0 commit comments

Comments
 (0)