public void internalDestroy() { this.shouldDestroy.set(true); // probably already set but make sure synchronized (this) { this.active = false; notifyAll(); Connection myCon = connection; if (myCon != null) { myCon.destroy(); connection = null; } } }
public void internalDestroy() { Connection currentConn = (Connection) this.clientToServerConn.get(); if (currentConn != null) { if (!this.clientToServerConn.compareAndSet(currentConn, null)) { // someone else did (or is doing) the internalDestroy so return return; } try { currentConn.destroy(); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("SubscriptionConnectionImpl - error destroying client to server connection", e); } } } ClientUpdater currentUpdater = updater; if (currentUpdater != null) { try { currentUpdater.close(); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("SubscriptionConnectionImpl - error destroying client updater", e); } } } updater = null; }
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(); } }
} finally { if (!initialized && connection != null) { connection.destroy(); failureTracker.addFailure(); connection = null;
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"); } }
private QueueConnectionImpl initializeQueueConnection(Connection connection, boolean isPrimary, ClientUpdater failedUpdater) { QueueConnectionImpl queueConnection = null; FailureTracker failureTracker = denyList.getFailureTracker(connection.getServer()); try { ClientUpdater updater = factory.createServerToClientConnection(connection.getEndpoint(), this, isPrimary, failedUpdater); if (updater != null) { queueConnection = new QueueConnectionImpl(this, connection, updater, failureTracker); } else { logger.warn("unable to create a subscription connection to server {}", connection.getEndpoint()); } } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("error creating subscription connection to server {}", connection.getEndpoint(), e); } } if (queueConnection == null) { failureTracker.addFailure(); connection.destroy(); } return queueConnection; }
conn.destroy(); if (invalidateServer) { endpointManager.serverCrashed(conn.getEndpoint());
primaryQueue = initializeQueueConnection(newPrimary, true, null); if (primaryQueue == null) { newPrimary.destroy(); } else { if (!addToConnectionList(primaryQueue, true)) {
con.destroy(); return false;
if (!this.allConnectionsMap.hasExpiredCnxToServer(currentServer)) { getPoolStats().incLoadConditioningReplaceTimeouts(); con.destroy(); break;