Skip to content

Commit

Permalink
PHOENIX-6276: Log when hconnection is getting closed in ConnectionQue…
Browse files Browse the repository at this point in the history
…ryServicesImpl
  • Loading branch information
Sandeep Pal committed Jan 4, 2021
1 parent c1f16d4 commit 870bbf1
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,16 @@ private void openConnection() throws SQLException {
}
}

// Close the HBase Connection
private void closeConnection() throws IOException {
if (connection != null) {
connection.close();
LOGGER.info("HConnection closed. Stacktrace for informational purposes: "
+ connection + " " + LogUtil.getCallerStackTrace());
}
GLOBAL_HCONNECTIONS_COUNTER.decrement();
}

@Override
public Table getTable(byte[] tableName) throws SQLException {
try {
Expand Down Expand Up @@ -571,8 +581,7 @@ public void close() throws SQLException {
}
try {
// close the HBase connection
if (connection != null) connection.close();
GLOBAL_HCONNECTIONS_COUNTER.decrement();
closeConnection();
} finally {
if (renewLeaseExecutor != null) {
renewLeaseExecutor.shutdownNow();
Expand Down Expand Up @@ -3322,7 +3331,7 @@ Collections.<Class<? extends Exception>> singletonList(
} finally {
try {
if (!success && hConnectionEstablished) {
connection.close();
closeConnection();
}
} catch (IOException e) {
SQLException ex = new SQLException(e);
Expand Down

0 comments on commit 870bbf1

Please sign in to comment.