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 <pankajkumar@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
Signed-off-by: Sean Busbey <busbey@apache.org>
  • Loading branch information
mokai87 authored and virajjasani committed Aug 21, 2020
1 parent 4667a97 commit a914f2e
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,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);
Expand All @@ -202,6 +206,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;
Expand Down

0 comments on commit a914f2e

Please sign in to comment.