Search in sources :

Example 1 with BaselineTopologyUpdater

use of org.apache.ignite.internal.processors.cluster.baseline.autoadjust.BaselineTopologyUpdater in project ignite by apache.

the class GridClusterStateProcessor method onKernalStart.

/**
 * {@inheritDoc}
 */
@Override
public void onKernalStart(boolean active) throws IgniteCheckedException {
    baselineTopologyUpdater = new BaselineTopologyUpdater(ctx);
    ctx.event().addLocalEventListener(event -> {
        DiscoveryEvent discoEvt = (DiscoveryEvent) event;
        if (discoEvt.eventNode().isClient() || discoEvt.eventNode().isDaemon())
            return;
        baselineTopologyUpdater.triggerBaselineUpdate(discoEvt.topologyVersion());
    }, EVT_NODE_FAILED, EVT_NODE_LEFT, EVT_NODE_JOINED);
    distributedBaselineConfiguration.listenAutoAdjustEnabled((name, oldVal, newVal) -> {
        if (newVal != null && newVal) {
            long topVer = ctx.discovery().topologyVersion();
            baselineTopologyUpdater.triggerBaselineUpdate(topVer);
        }
    });
}
Also used : BaselineTopologyUpdater(org.apache.ignite.internal.processors.cluster.baseline.autoadjust.BaselineTopologyUpdater) DiscoveryEvent(org.apache.ignite.events.DiscoveryEvent)

Aggregations

DiscoveryEvent (org.apache.ignite.events.DiscoveryEvent)1 BaselineTopologyUpdater (org.apache.ignite.internal.processors.cluster.baseline.autoadjust.BaselineTopologyUpdater)1