use of com.couchbase.client.core.cnc.events.config.ConfigIgnoredEvent 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 BucketConfig newConfig) {
final String name = newConfig.name();
final BucketConfig oldConfig = currentConfig.bucketConfig(name);
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.of(newConfig.name())));
return;
}
if (newConfig.tainted()) {
keyValueRefresher.markTainted(name);
clusterManagerRefresher.markTainted(name);
} else {
keyValueRefresher.markUntainted(name);
clusterManagerRefresher.markUntainted(name);
}
eventBus.publish(new BucketConfigUpdatedEvent(core.context(), newConfig));
currentConfig.setBucketConfig(newConfig);
checkAlternateAddress();
updateSeedNodeList();
pushConfig();
}
use of com.couchbase.client.core.cnc.events.config.ConfigIgnoredEvent in project couchbase-jvm-clients by couchbase.
the class DefaultConfigurationProvider method proposeBucketConfig.
@Override
public void proposeBucketConfig(final ProposedBucketConfigContext ctx) {
if (!shutdown.get()) {
try {
BucketConfig config = BucketConfigParser.parse(ctx.config(), core.context().environment(), ctx.origin());
checkAndApplyConfig(config);
} catch (Exception ex) {
eventBus.publish(new ConfigIgnoredEvent(core.context(), ConfigIgnoredEvent.Reason.PARSE_FAILURE, Optional.of(ex), Optional.of(ctx.config()), Optional.of(ctx.bucketName())));
}
} else {
eventBus.publish(new ConfigIgnoredEvent(core.context(), ConfigIgnoredEvent.Reason.ALREADY_SHUTDOWN, Optional.empty(), Optional.of(ctx.config()), Optional.of(ctx.bucketName())));
}
}
use of com.couchbase.client.core.cnc.events.config.ConfigIgnoredEvent 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();
}
use of com.couchbase.client.core.cnc.events.config.ConfigIgnoredEvent in project couchbase-jvm-clients by couchbase.
the class DefaultConfigurationProvider method proposeGlobalConfig.
@Override
public void proposeGlobalConfig(final ProposedGlobalConfigContext ctx) {
if (!shutdown.get()) {
try {
GlobalConfig config = GlobalConfigParser.parse(ctx.config(), ctx.origin());
checkAndApplyConfig(config);
} catch (Exception ex) {
eventBus.publish(new ConfigIgnoredEvent(core.context(), ConfigIgnoredEvent.Reason.PARSE_FAILURE, Optional.of(ex), Optional.of(ctx.config()), Optional.empty()));
}
} else {
eventBus.publish(new ConfigIgnoredEvent(core.context(), ConfigIgnoredEvent.Reason.ALREADY_SHUTDOWN, Optional.empty(), Optional.of(ctx.config()), Optional.empty()));
}
}
Aggregations