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
4667a971b1
commit
a914f2efeb
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue