/** {@inheritDoc} * @see java.lang.Runnable#run() */ // @Override public void run() { try { this.connectionHandle.setThreadWatch(Thread.currentThread()); // wait for the thread we're monitoring to die off. this.threadToMonitor.join(this.closeConnectionWatchTimeout); if (!this.connectionHandle.isClosed() && this.threadToMonitor.equals(this.connectionHandle.getThreadUsingConnection()) ){ logger.error(this.stackTrace); } } catch (Exception e) { // just kill off this thread if (this.connectionHandle != null){ // safety this.connectionHandle.setThreadWatch(null); } } }
/** Closes off this connection * @param connection to close */ protected void closeConnection(ConnectionHandle connection) { if (connection != null && !connection.isClosed()) { try { connection.internalClose(); } catch (SQLException e) { logger.error("Destroy connection exception", e); } finally { this.pool.postDestroyConnection(connection); connection.getOriginatingPartition().getPoolWatchThreadSignalQueue().offer(new Object()); // item being pushed is not important. } } }
} catch(SQLException e) { if (!isClosed()) { this.pool.connectionStrategy.cleanupConnection(this, handle); this.pool.releaseConnection(this);