diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java index 039ff4d12f8..83193600f01 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java @@ -192,6 +192,10 @@ class AsyncConnectionImpl implements AsyncConnection { if (closed) { return; } + LOG.info("Connection has been closed by {}.", Thread.currentThread().getName()); + if(LOG.isDebugEnabled()){ + logCallStack(Thread.currentThread().getStackTrace()); + } IOUtils.closeQuietly(clusterStatusListener); IOUtils.closeQuietly(rpcClient); IOUtils.closeQuietly(registry); @@ -202,6 +206,16 @@ class AsyncConnectionImpl implements AsyncConnection { closed = true; } + private void logCallStack(StackTraceElement[] stackTraceElements) { + StringBuilder stackBuilder = new StringBuilder("Call stack:"); + for (StackTraceElement element : stackTraceElements) { + stackBuilder.append("\n at "); + stackBuilder.append(element); + } + stackBuilder.append("\n"); + LOG.debug(stackBuilder.toString()); + } + @Override public boolean isClosed() { return closed;