/** * Handles a cluster event. */ private void handleClusterEvent(ClusterEvent event) { NodeListener nodeListener = this.listener; if (nodeListener != null) { context.execute(() -> { if (active.get()) { switch (event.type()) { case NODE_ACTIVATED: nodeListener.nodeAdded(event.subject().id().id()); break; case NODE_DEACTIVATED: nodeListener.nodeLeft(event.subject().id().id()); break; default: break; } } }); } }
@Override public void nodeListener(final NodeListener listener) { this.nodeListener = listener; }
@Override public void nodeListener(NodeListener listener) { this.nodeListener = listener; }
@Override public void nodeListener(NodeListener listener) { logTrace(() -> String.format("Set nodeListener [%s] on address [%s]", listener, address)); topologyListener.setNodeListener(listener); }
public void setNodeListener(NodeListener nodeListener) { logDebug(() -> String.format("Set topology listener [%s]", nodeListener)); this.nodeListener = Optional.of(nodeListener); }