HBASE-24686 [LOG] Log improvement in Connection#close (#2219)
Signed-off-by: Pankaj Kumar <pankajkumar@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
parent
54fe81eb56
commit
72be041d1c
|
@ -201,6 +201,10 @@ class AsyncConnectionImpl implements AsyncConnection {
|
|||
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);
|
||||
|
@ -214,6 +218,16 @@ class AsyncConnectionImpl implements AsyncConnection {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue