io.vertx.core.spi.cluster.NodeListener Java Examples

The following examples show how to use io.vertx.core.spi.cluster.NodeListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AtomixClusterManager.java    From atomix-vertx with Apache License 2.0 6 votes vote down vote up
/**
 * Handles a cluster event.
 */
private void handleClusterEvent(ClusterMembershipEvent event) {
  NodeListener nodeListener = this.listener;
  if (nodeListener != null) {
    context.execute(() -> {
      if (active.get()) {
        switch (event.type()) {
          case MEMBER_ADDED:
            nodeListener.nodeAdded(event.subject().id().id());
            break;
          case MEMBER_REMOVED:
            nodeListener.nodeLeft(event.subject().id().id());
            break;
          default:
            break;
        }
      }
    });
  }
}
 
Example #2
Source File: LealoneVertxClusterManager.java    From Lealone-Plugins with Apache License 2.0 4 votes vote down vote up
@Override
public void nodeListener(NodeListener listener) {
}