io.vertx.core.spi.cluster

## Interface ClusterManager

- All Known Implementing Classes:
    HazelcastClusterManager

      public interface ClusterManager

  A cluster provider for Vert.x must implement this interface. In order for HA to work correctly, all implementations of this interface MUST be implemented such that: 1. Whenever a node joins or leaves the cluster the registered NodeListener (if any) MUST be called with the appropriate join or leave event. 2. For all nodes that are part of the cluster, the registered NodeListener MUST be called with the exact same sequence of join and leave events on all nodes. 3. For any particular join or leave event that is handled in any NodeListener, anywhere in the cluster, the List of nodes returned by getNodes must be identical. 4. All of the methods in the implementation must return immediately, i.e. they must not block while the operation is being executed. If the underlying implementation does block, then `Vertx.executeBlocking(io.vertx.core.Handler<io.vertx.core.Future<T>>, boolean, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)` should be used to run the operation on a worker.
  Author:
    Tim Fox

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `<K,V> void` | `getAsyncMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)` Return an async map for the given name
    `<K,V> void` | `getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K,V>>> resultHandler)` Return an async multi-map for the given name
    `void` | `getCounter(String name, Handler<AsyncResult<Counter>> resultHandler)`
    `void` | `getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler)`
    `String` | `getNodeID()` Return the unique node ID for this node
    `List<String>` | `getNodes()` Return a list of node IDs corresponding to the nodes in the cluster
    `<K,V> Map<K,V>` | `getSyncMap(String name)` Return a synchronous map for the given name
    `boolean` | `isActive()` Is the cluster manager active?
    `void` | `join(Handler<AsyncResult<Void>> resultHandler)` Join the cluster
    `void` | `leave(Handler<AsyncResult<Void>> resultHandler)` Leave the cluster
    `void` | `nodeListener(NodeListener listener)` Set a listener that will be called when a node joins or leaves the cluster.
    `void` | `setVertx(Vertx vertx)`

- - ### Method Detail

    - #### setVertx

          void setVertx(Vertx vertx)

    - #### getAsyncMultiMap

          <K,V> void getAsyncMultiMap(String name,
                                      Handler<AsyncResult<AsyncMultiMap<K,V>>> resultHandler)

      Return an async multi-map for the given name

    - #### getAsyncMap

          <K,V> void getAsyncMap(String name,
                                 Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)

      Return an async map for the given name

    - #### getSyncMap

          <K,V> Map<K,V> getSyncMap(String name)

      Return a synchronous map for the given name

    - #### getLockWithTimeout

          void getLockWithTimeout(String name,
                                  long timeout,
                                  Handler<AsyncResult<Lock>> resultHandler)

    - #### getCounter

          void getCounter(String name,
                          Handler<AsyncResult<Counter>> resultHandler)

    - #### getNodeID

          String getNodeID()

      Return the unique node ID for this node

    - #### getNodes

          List<String> getNodes()

      Return a list of node IDs corresponding to the nodes in the cluster

    - #### nodeListener

          void nodeListener(NodeListener listener)

      Set a listener that will be called when a node joins or leaves the cluster.
      Parameters:
        `listener` -

    - #### join

          void join(Handler<AsyncResult<Void>> resultHandler)

      Join the cluster

    - #### leave

          void leave(Handler<AsyncResult<Void>> resultHandler)

      Leave the cluster

    - #### isActive

          boolean isActive()

      Is the cluster manager active?
      Returns:
        true if active, false otherwise

Copyright © 2015. All rights reserved.