HBASE-15148 Resolve IS2_INCONSISTENT_SYNC findbugs warning in AuthenticationTokenSecretManager (Yu Li)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/f9e69b51 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f9e69b51 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f9e69b51 Branch: refs/heads/hbase-12439 Commit: f9e69b51e1997c6de2ed74f9edbc6947b11c88dc Parents: b1df2f8 Author: tedyu <[email protected]> Authored: Fri Jan 22 02:47:49 2016 -0800 Committer: tedyu <[email protected]> Committed: Fri Jan 22 02:47:49 2016 -0800 ---------------------------------------------------------------------- .../security/token/AuthenticationTokenSecretManager.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/f9e69b51/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java index 72f4598..de66827 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java @@ -285,6 +285,10 @@ public class AuthenticationTokenSecretManager } } + synchronized long getLastKeyUpdate() { + return lastKeyUpdate; + } + public static SecretKey createSecretKey(byte[] raw) { return SecretManager.createSecretKey(raw); } @@ -338,10 +342,7 @@ public class AuthenticationTokenSecretManager // clear any expired removeExpiredKeys(); - long localLastKeyUpdate; - synchronized (this) { - localLastKeyUpdate = lastKeyUpdate; - } + long localLastKeyUpdate = getLastKeyUpdate(); if (localLastKeyUpdate + keyUpdateInterval < now) { // roll a new master key rollCurrentKey();
