public void internalClose(boolean keepAlive) throws Exception { try { getConnection().close(keepAlive); } finally { if (updater != null) { updater.close(); } } }
private void waitForFailedUpdater() { boolean gotInterrupted = false; try { if (this.failedUpdater != null) { logger.info("{} is waiting for {} to complete.", new Object[] {this, this.failedUpdater}); while (this.failedUpdater.isAlive()) { if (quitting()) { return; } this.failedUpdater.join(5000); } } } catch (InterruptedException ignore) { gotInterrupted = true; // just bail, because I have not done anything yet } finally { if (!gotInterrupted && this.failedUpdater != null) { logger.info("{} has completed waiting for {}", new Object[] {this, this.failedUpdater}); this.failedUpdater = null; } } }
synchronized (lock) { ClientUpdater cu = connection.getUpdater(); if (cu == null || (!cu.isAlive()) || (!cu.isProcessing())) return false;// don't add
void endpointCrashed(Endpoint endpoint) { QueueConnectionImpl deadConnection = null; // We must be synchronized while checking to see if we have a queue connection for the endpoint, // because when we need to prevent a race between adding a queue connection to the map // and the endpoint for that connection crashing. synchronized (lock) { deadConnection = queueConnections.getConnection(endpoint); if (deadConnection != null) { queueConnections = queueConnections.removeConnection(deadConnection); } } if (deadConnection != null) { logger .info("{} subscription endpoint {} crashed. Scheduling recovery.", new Object[] {deadConnection.getUpdater() != null ? (deadConnection.getUpdater().isPrimary() ? "Primary" : "Redundant") : "Queue", endpoint}); scheduleRedundancySatisfierIfNeeded(0); deadConnection.internalDestroy(); } else { if (logger.isDebugEnabled()) { logger.debug("Ignoring crashed endpoint {} it does not have a queue.", endpoint); } } }
public boolean isPrimaryUpdaterAlive() { boolean result = false; QueueConnectionImpl primary = (QueueConnectionImpl) queueConnections.getPrimary(); if (primary != null) { ClientUpdater cu = primary.getUpdater(); if (cu != null) { result = cu.isAlive(); } } return result; }
updater.setFailedUpdater(queueConnections.getFailedUpdater()); MakePrimaryOp.execute(pool, cnx, haveSentClientReady); result = true;
.info("Cache client updater for {} on endpoint {} exiting. Scheduling recovery.", (deadConnection != null && deadConnection.getUpdater() != null) ? (deadConnection.getUpdater().isPrimary() ? "Primary" : "Redundant") : "Queue", endpoint);
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; }