Search in sources :

Example 1 with GlobalConfigUpdatedEvent

use of com.couchbase.client.core.cnc.events.config.GlobalConfigUpdatedEvent in project couchbase-jvm-clients by couchbase.

the class DefaultConfigurationProvider method checkAndApplyConfig.

/**
 * Analyzes the given config and decides if to apply it (and does so if needed).
 *
 * @param newConfig the config to apply.
 */
private void checkAndApplyConfig(final GlobalConfig newConfig) {
    final GlobalConfig oldConfig = currentConfig.globalConfig();
    if (oldConfig != null && configIsOlderOrSame(oldConfig.revEpoch(), newConfig.revEpoch(), oldConfig.rev(), newConfig.rev())) {
        eventBus.publish(new ConfigIgnoredEvent(core.context(), ConfigIgnoredEvent.Reason.OLD_OR_SAME_REVISION, Optional.empty(), Optional.empty(), Optional.empty()));
        return;
    }
    eventBus.publish(new GlobalConfigUpdatedEvent(core.context(), newConfig));
    currentConfig.setGlobalConfig(newConfig);
    checkAlternateAddress();
    updateSeedNodeList();
    pushConfig();
}
Also used : GlobalConfigUpdatedEvent(com.couchbase.client.core.cnc.events.config.GlobalConfigUpdatedEvent) ConfigIgnoredEvent(com.couchbase.client.core.cnc.events.config.ConfigIgnoredEvent)

Aggregations

ConfigIgnoredEvent (com.couchbase.client.core.cnc.events.config.ConfigIgnoredEvent)1 GlobalConfigUpdatedEvent (com.couchbase.client.core.cnc.events.config.GlobalConfigUpdatedEvent)1