use of org.apache.ignite.internal.processors.configuration.distributed.DistributedConfigurationProcessor.AllowableAction.ACTUALIZE in project ignite by apache.
the class DistributedConfigurationProcessor method start.
/**
* {@inheritDoc}
*/
@Override
public void start() throws IgniteCheckedException {
GridInternalSubscriptionProcessor isp = ctx.internalSubscriptionProcessor();
isp.registerDistributedMetastorageListener(new DistributedMetastorageLifecycleListener() {
@Override
public void onReadyForRead(ReadableDistributedMetaStorage metastorage) {
distributedMetastorage = ctx.distributedMetastorage();
// Listener for handling of cluster wide change of specific properties. Do local update.
distributedMetastorage.listen((key) -> key.startsWith(DIST_CONF_PREFIX), (String key, Serializable oldVal, Serializable newVal) -> {
DistributedChangeableProperty prop = props.get(toPropertyKey(key));
if (prop != null)
prop.localUpdate(newVal);
});
// Switch to actualize action and actualize already registered properties.
switchCurrentActionTo(ACTUALIZE);
// Register and actualize properties waited for this service.
isp.getDistributedConfigurationListeners().forEach(listener -> listener.onReadyToRegister(DistributedConfigurationProcessor.this));
}
@Override
public void onReadyForWrite(DistributedMetaStorage metastorage) {
// Switch to cluster wide update action and do it on already registered properties.
switchCurrentActionTo(CLUSTER_WIDE_UPDATE);
isp.getDistributedConfigurationListeners().forEach(DistributedConfigurationLifecycleListener::onReadyToWrite);
}
});
}
Aggregations