You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2019/02/13 22:28:18 UTC
[hbase] branch branch-1.4 updated: HBASE-21884 Fix box/unbox
findbugs warning in secure bulk load
This is an automated email from the ASF dual-hosted git repository.
busbey pushed a commit to branch branch-1.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-1.4 by this push:
new 93d7427 HBASE-21884 Fix box/unbox findbugs warning in secure bulk load
93d7427 is described below
commit 93d742750414c7d5cf6c15fd115fcfbd1b0e0d7d
Author: Sean Busbey <bu...@apache.org>
AuthorDate: Tue Feb 12 20:53:14 2019 -0600
HBASE-21884 Fix box/unbox findbugs warning in secure bulk load
Signed-off-by: Peter Somogyi <ps...@apache.org>
(cherry picked from commit 6296bad9cf52a9f6880351b3e52916a330199811)
---
.../security/access/SecureBulkLoadEndpoint.java | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SecureBulkLoadEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SecureBulkLoadEndpoint.java
index 0540524..f400fd4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SecureBulkLoadEndpoint.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/SecureBulkLoadEndpoint.java
@@ -24,6 +24,7 @@ import com.google.protobuf.RpcController;
import com.google.protobuf.Service;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.mutable.MutableInt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
@@ -139,7 +140,7 @@ public class SecureBulkLoadEndpoint extends SecureBulkLoadService
private Connection conn;
private UserProvider userProvider;
- private static HashMap<UserGroupInformation, Integer> ugiReferenceCounter = new HashMap<>();
+ private static HashMap<UserGroupInformation, MutableInt> ugiReferenceCounter = new HashMap<>();
@Override
public void start(CoprocessorEnvironment env) {
@@ -276,26 +277,30 @@ public class SecureBulkLoadEndpoint extends SecureBulkLoadService
private void incrementUgiReference(UserGroupInformation ugi) {
synchronized (ugiReferenceCounter) {
- Integer counter = ugiReferenceCounter.get(ugi);
- ugiReferenceCounter.put(ugi, counter == null ? 1 : ++counter);
+ final MutableInt counter = ugiReferenceCounter.get(ugi);
+ if (counter == null) {
+ ugiReferenceCounter.put(ugi, new MutableInt(1));
+ } else {
+ counter.increment();
+ }
}
}
private void decrementUgiReference(UserGroupInformation ugi) {
synchronized (ugiReferenceCounter) {
- Integer counter = ugiReferenceCounter.get(ugi);
- if(counter == null || counter <= 1) {
+ final MutableInt counter = ugiReferenceCounter.get(ugi);
+ if(counter == null || counter.intValue() <= 1) {
ugiReferenceCounter.remove(ugi);
} else {
- ugiReferenceCounter.put(ugi,--counter);
+ counter.decrement();
}
}
}
private boolean isUserReferenced(UserGroupInformation ugi) {
synchronized (ugiReferenceCounter) {
- Integer count = ugiReferenceCounter.get(ugi);
- return count != null && count > 0;
+ final MutableInt counter = ugiReferenceCounter.get(ugi);
+ return counter != null && counter.intValue() > 0;
}
}