@Override public boolean isConnectedToRemote() { return connection != null && !connection.isDestroyed(); }
public void destroyConnection() { this.connectionLifeCycleLock.writeLock().lock(); try { Connection con = this.connection; if (con != null) { if (!con.isDestroyed()) { con.destroy(); this.sender.getProxy().returnConnection(con); } // Reset the connection so the next time through a new one will be // obtained this.connection = null; this.sender.setServerLocation(null); } } finally { this.connectionLifeCycleLock.writeLock().unlock(); } }
public ServerLocation getNextOpServerLocation() { ServerLocation retVal = null; Connection conn = (Connection) (threadLocalConnections ? localConnection.get() : null); if (conn == null || conn.isDestroyed()) { conn = connectionManager.borrowConnection(serverTimeout); retVal = conn.getServer(); this.connectionManager.returnConnection(conn); } else { retVal = conn.getServer(); } return retVal; }
public void shutdown() { // we need to destroy connection irrespective of we are listening on it or // not. No need to take lock as the reader thread may be blocked and we might not // get chance to destroy unless that returns. Connection conn = connection; if (conn != null) { shutDownAckReaderConnection(conn); if (!conn.isDestroyed()) { conn.destroy(); sender.getProxy().returnConnection(conn); } } this.shutdown = true; boolean interrupted = Thread.interrupted(); try { this.join(15 * 1000); } catch (InterruptedException e) { interrupted = true; } finally { if (interrupted) { Thread.currentThread().interrupt(); } } if (this.isAlive()) { logger.warn("AckReaderThread ignored cancellation"); } }
if (conn == null || conn.isDestroyed()) { conn = connectionManager.borrowConnection(serverTimeout); } else if (threadLocalConnections) { if (!conn.isDestroyed()) { localConnection.set(conn); } else {
if (this.connection == null || this.connection.isDestroyed() || !this.connection.getServer().equals(this.sender.getServerLocation())) { if (logger.isDebugEnabled()) { if (this.connection == null || this.connection.isDestroyed()) { initializeConnection();