Skip to content

Commit

Permalink
HBASE-24686 [LOG] Log improvement in Connection#close (#2219)
Browse files Browse the repository at this point in the history
Signed-off-by: Pankaj Kumar <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>
Signed-off-by: Sean Busbey <[email protected]>
  • Loading branch information
mokai87 authored Aug 21, 2020
1 parent 54fe81e commit 72be041
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ public void close() {
if (!closed.compareAndSet(false, true)) {
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);
Expand All @@ -214,6 +218,16 @@ public void close() {
}
}

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 AsyncTableRegionLocator getRegionLocator(TableName tableName) {
return new AsyncTableRegionLocatorImpl(tableName, this);
Expand Down

0 comments on commit 72be041

Please sign in to comment.