Search in sources :

Example 11 with ClientServerObserver

use of org.apache.geode.internal.cache.ClientServerObserver in project geode by apache.

the class QueueManagerImpl method promoteBackupCnxToPrimary.

private boolean promoteBackupCnxToPrimary(QueueConnectionImpl cnx) {
    boolean result = false;
    if (PoolImpl.BEFORE_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG) {
        ClientServerObserver bo = ClientServerObserverHolder.getInstance();
        bo.beforePrimaryIdentificationFromBackup();
    }
    try {
        boolean haveSentClientReady = this.sentClientReady;
        if (haveSentClientReady) {
            cnx.sendClientReady();
        }
        ClientUpdater updater = cnx.getUpdater();
        if (updater == null) {
            if (logger.isDebugEnabled()) {
                logger.debug("backup connection was destroyed before it could become the primary.");
            }
            Assert.assertTrue(cnx.isDestroyed());
        } else {
            updater.setFailedUpdater(queueConnections.getFailedUpdater());
            MakePrimaryOp.execute(pool, cnx, haveSentClientReady);
            result = true;
            if (PoolImpl.AFTER_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG) {
                ClientServerObserver bo = ClientServerObserverHolder.getInstance();
                bo.afterPrimaryIdentificationFromBackup(cnx.getServer());
            }
        }
    } catch (Exception e) {
        if (pool.getPoolOrCacheCancelInProgress() == null && logger.isDebugEnabled()) {
            logger.debug("Error making a backup server the primary server for client subscriptions", e);
        }
    }
    return result;
}
Also used : ClientServerObserver(org.apache.geode.internal.cache.ClientServerObserver) CacheClientUpdater(org.apache.geode.internal.cache.tier.sockets.CacheClientUpdater) CancelException(org.apache.geode.CancelException) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) GemFireException(org.apache.geode.GemFireException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) ServerConnectivityException(org.apache.geode.cache.client.ServerConnectivityException) GemFireConfigException(org.apache.geode.GemFireConfigException) NoSubscriptionServersAvailableException(org.apache.geode.cache.NoSubscriptionServersAvailableException)

Aggregations

ClientServerObserver (org.apache.geode.internal.cache.ClientServerObserver)11 CancelException (org.apache.geode.CancelException)4 GemFireSecurityException (org.apache.geode.security.GemFireSecurityException)4 IOException (java.io.IOException)3 InterruptedIOException (java.io.InterruptedIOException)3 ConnectException (java.net.ConnectException)3 SocketException (java.net.SocketException)3 List (java.util.List)3 SSLException (javax.net.ssl.SSLException)3 InvalidDeltaException (org.apache.geode.InvalidDeltaException)3 EntryNotFoundException (org.apache.geode.cache.EntryNotFoundException)3 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)3 ServerRefusedConnectionException (org.apache.geode.cache.client.ServerRefusedConnectionException)3 Endpoint (org.apache.geode.cache.client.internal.Endpoint)3 ConcurrentCacheModificationException (org.apache.geode.internal.cache.versions.ConcurrentCacheModificationException)3 AuthenticationFailedException (org.apache.geode.security.AuthenticationFailedException)3 AuthenticationRequiredException (org.apache.geode.security.AuthenticationRequiredException)3 ClientServerObserverAdapter (org.apache.geode.internal.cache.ClientServerObserverAdapter)2 VersionedObjectList (org.apache.geode.internal.cache.tier.sockets.VersionedObjectList)2 ArrayList (java.util.ArrayList)1