Skip to content

Commit fc21e92

Browse files
committed
HDFS-3615. Two BlockTokenSecretManager findbugs warnings. Contributed by Aaron T. Myers.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1360255 13f79535-47bb-0310-9956-ffa450edef68
1 parent a8b6caa commit fc21e92

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,8 @@ Branch-2 ( Unreleased changes )
450450
HDFS-3548. NamenodeFsck.copyBlock fails to create a Block Reader.
451451
(Colin Patrick McCabe via eli)
452452

453+
HDFS-3615. Two BlockTokenSecretManager findbugs warnings. (atm)
454+
453455
BREAKDOWN OF HDFS-3042 SUBTASKS
454456

455457
HDFS-2185. HDFS portion of ZK-based FailoverController (todd)

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/block/BlockTokenSecretManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private BlockTokenSecretManager(boolean isMaster, long keyUpdateInterval,
116116
}
117117

118118
@VisibleForTesting
119-
public void setSerialNo(int serialNo) {
119+
public synchronized void setSerialNo(int serialNo) {
120120
this.serialNo = (serialNo & LOW_MASK) | (nnIndex << 31);
121121
}
122122

@@ -189,7 +189,7 @@ public synchronized void addKeys(ExportedBlockKeys exportedKeys)
189189
* Update block keys if update time > update interval.
190190
* @return true if the keys are updated.
191191
*/
192-
public boolean updateKeys(final long updateTime) throws IOException {
192+
public synchronized boolean updateKeys(final long updateTime) throws IOException {
193193
if (updateTime > keyUpdateInterval) {
194194
return updateKeys();
195195
}
@@ -371,7 +371,7 @@ public byte[] retrievePassword(BlockTokenIdentifier identifier)
371371
}
372372

373373
@VisibleForTesting
374-
public void setKeyUpdateIntervalForTesting(long millis) {
374+
public synchronized void setKeyUpdateIntervalForTesting(long millis) {
375375
this.keyUpdateInterval = millis;
376376
}
377377

@@ -381,7 +381,7 @@ public void clearAllKeysForTesting() {
381381
}
382382

383383
@VisibleForTesting
384-
public int getSerialNoForTesting() {
384+
public synchronized int getSerialNoForTesting() {
385385
return serialNo;
386386
}
387387

0 commit comments

Comments
 (0)