diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java index f7d465838d6..62a79985b83 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java @@ -170,8 +170,6 @@ class ConnectionImplementation implements ClusterConnection, Closeable { private final MetaCache metaCache; private final MetricsConnection metrics; - private int refCount; - protected User user; private RpcRetryingCallerFactory rpcCallerFactory; @@ -2138,22 +2136,6 @@ class ConnectionImplementation implements ClusterConnection, Closeable { return this.registry.getCurrentNrHRS(); } - /** - * Increment this client's reference count. - */ - void incCount() { - ++refCount; - } - - /** - * Decrement this client's reference count. - */ - void decCount() { - if (refCount > 0) { - --refCount; - } - } - @Override public void close() { if (this.closed) { @@ -2176,13 +2158,9 @@ class ConnectionImplementation implements ClusterConnection, Closeable { } /** - * Close the connection for good, regardless of what the current value of - * {@link #refCount} is. Ideally, {@link #refCount} should be zero at this - * point, which would be the case if all of its consumers close the - * connection. However, on the off chance that someone is unable to close + * Close the connection for good. On the off chance that someone is unable to close * the connection, perhaps because it bailed out prematurely, the method - * below will ensure that this {@link org.apache.hadoop.hbase.client.HConnection} instance - * is cleaned up. + * below will ensure that this instance is cleaned up. * Caveat: The JVM may take an unknown amount of time to call finalize on an * unreachable object, so our hope is that every consumer cleans up after * itself, like any good citizen. @@ -2190,8 +2168,6 @@ class ConnectionImplementation implements ClusterConnection, Closeable { @Override protected void finalize() throws Throwable { super.finalize(); - // Pretend as if we are about to release the last remaining reference - refCount = 1; close(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/HConnectionTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/HConnectionTestingUtility.java index 06fdd7f0bc8..24c0c32cb63 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/HConnectionTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/HConnectionTestingUtility.java @@ -117,8 +117,6 @@ public class HConnectionTestingUtility { Mockito.when(c.getAsyncProcess()).thenReturn( new AsyncProcess(c, conf, null, RpcRetryingCallerFactory.instantiate(conf), false, RpcControllerFactory.instantiate(conf))); - Mockito.doNothing().when(c).incCount(); - Mockito.doNothing().when(c).decCount(); Mockito.when(c.getNewRpcRetryingCallerFactory(conf)).thenReturn( RpcRetryingCallerFactory.instantiate(conf, RetryingCallerInterceptorFactory.NO_OP_INTERCEPTOR, null));