/** * Return the cache client updater from the previously failed primary * * @return the previous updater or null if there is no previous updater */ public ClientUpdater getFailedUpdater() { if (failedPrimary != null) { return failedPrimary.getUpdater(); } else { return null; } }
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; }
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); } } }
if (deadConnection != null && ccu.equals(deadConnection.getUpdater())) { queueConnections = queueConnections.removeConnection(deadConnection); try { (deadConnection != null && deadConnection.getUpdater() != null) ? (deadConnection.getUpdater().isPrimary() ? "Primary" : "Redundant") : "Queue", endpoint);
private boolean addToConnectionList(QueueConnectionImpl connection, boolean isPrimary) { boolean isBadConnection; synchronized (lock) { ClientUpdater cu = connection.getUpdater(); if (cu == null || (!cu.isAlive()) || (!cu.isProcessing())) return false;// don't add
cnx.sendClientReady(); ClientUpdater updater = cnx.getUpdater(); if (updater == null) { if (logger.isDebugEnabled()) {
void createClientCacheAndVerifyPingIntervalIsSet(String host, int port) throws Exception { PoolImpl pool = null; try { Properties props = new Properties(); props.setProperty(MCAST_PORT, "0"); props.setProperty(LOCATORS, ""); createCache(props); pool = (PoolImpl) PoolManager.createFactory().addServer(host, port) .setSubscriptionEnabled(true).setThreadLocalConnections(false).setReadTimeout(1000) .setSocketBufferSize(32768).setMinConnections(1).setSubscriptionRedundancy(-1) .setPingInterval(2000).create("test pool"); Region<Object, Object> region = cache.createRegionFactory(RegionShortcut.LOCAL) .setPoolName("test pool").create(REGION_NAME1); region.registerInterest(".*"); /** get the subscription connection and verify that it has the correct timeout setting */ QueueConnectionImpl primaryConnection = (QueueConnectionImpl) pool.getPrimaryConnection(); int pingInterval = ((CacheClientUpdater) primaryConnection.getUpdater()) .getServerQueueStatus().getPingInterval(); assertNotEquals(0, pingInterval); assertEquals(CacheClientNotifier.getClientPingInterval(), pingInterval); } finally { cache.close(); } }