Skip to content

Commit

Permalink
HBASE-24686 [LOG] Log improvement in Connection#close (apache#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>
(cherry picked from commit 31fb9fc)

Change-Id: I04f188d582df7c32ad62115beecbb140d3f5b395
  • Loading branch information
mokai87 authored and virajjasani committed Aug 23, 2020
1 parent bbcd2f3 commit 4c281cb
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 4c281cb

Please sign in to comment.