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;
}
Aggregations