diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Counter.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Counter.java index 92c0a8f54db..ce0fdddde3b 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Counter.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Counter.java @@ -108,25 +108,12 @@ public class Counter { return h; } - private static class IndexHolder { - int index = hash(); - } - - private final ThreadLocal indexHolderThreadLocal = - new ThreadLocal() { - @Override - protected IndexHolder initialValue() { - return new IndexHolder(); - } - }; - public void add(long delta) { Container container = containerRef.get(); Cell[] cells = container.cells; int mask = cells.length - 1; - IndexHolder indexHolder = indexHolderThreadLocal.get(); - int baseIndex = indexHolder.index; + int baseIndex = hash(); if(cells[baseIndex & mask].add(delta)) { return; } @@ -139,8 +126,6 @@ public class Counter { index++; } - indexHolder.index = index; - if(index - baseIndex >= cells.length && cells.length < MAX_CELLS_LENGTH && container.demoted.compareAndSet(false, true)) { @@ -181,10 +166,6 @@ public class Counter { return sum; } - public void destroy() { - indexHolderThreadLocal.remove(); - } - @Override public String toString() { Cell[] cells = containerRef.get().cells; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java index f7cc85fc634..564639fd1eb 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java @@ -2011,7 +2011,6 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver { LOG.trace(ignored); } } - rpcCount.destroy(); } private UserGroupInformation createUser(ConnectionHeader head) {