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 9f935f07bc47..535a89ab4d39 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 @@ -189,6 +189,10 @@ public void close() { 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); @@ -199,6 +203,16 @@ public void close() { 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;