public class ZookeeperClusterManager extends Object implements ClusterManager, org.apache.curator.framework.recipes.cache.PathChildrenCacheListener
Constructor and Description |
---|
ZookeeperClusterManager() |
ZookeeperClusterManager(org.apache.curator.framework.CuratorFramework curator) |
ZookeeperClusterManager(org.apache.curator.framework.CuratorFramework curator,
String nodeID) |
ZookeeperClusterManager(JsonObject config) |
ZookeeperClusterManager(String resourceLocation) |
Modifier and Type | Method and Description |
---|---|
void |
childEvent(org.apache.curator.framework.CuratorFramework client,
org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event) |
<K,V> void |
getAsyncMap(String name,
Handler<AsyncResult<AsyncMap<K,V>>> handler)
Return an async map for the given name
|
<K,V> void |
getAsyncMultiMap(String name,
Handler<AsyncResult<AsyncMultiMap<K,V>>> handler)
Every eventbus handler has an ID.
|
JsonObject |
getConfig() |
void |
getCounter(String name,
Handler<AsyncResult<Counter>> resultHandler) |
org.apache.curator.framework.CuratorFramework |
getCuratorFramework() |
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 |
setConfig(JsonObject conf) |
void |
setVertx(Vertx vertx) |
public ZookeeperClusterManager()
public ZookeeperClusterManager(org.apache.curator.framework.CuratorFramework curator)
public ZookeeperClusterManager(String resourceLocation)
public ZookeeperClusterManager(org.apache.curator.framework.CuratorFramework curator, String nodeID)
public ZookeeperClusterManager(JsonObject config)
public void setConfig(JsonObject conf)
public JsonObject getConfig()
public org.apache.curator.framework.CuratorFramework getCuratorFramework()
public void setVertx(Vertx vertx)
setVertx
in interface ClusterManager
public <K,V> void getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K,V>>> handler)
getAsyncMultiMap
in interface ClusterManager
name
- A unique name by which the the MultiMap can be identified within the cluster.
See the cluster config file (e.g. io.vertx.spi.cluster.impl.zookeeper.zookeeper.properties in case of ZookeeperClusterManager) for
additional MultiMap config parameters.public <K,V> void getAsyncMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> handler)
ClusterManager
getAsyncMap
in interface ClusterManager
public <K,V> Map<K,V> getSyncMap(String name)
ClusterManager
getSyncMap
in interface ClusterManager
public void getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler)
getLockWithTimeout
in interface ClusterManager
public void getCounter(String name, Handler<AsyncResult<Counter>> resultHandler)
getCounter
in interface ClusterManager
public String getNodeID()
ClusterManager
getNodeID
in interface ClusterManager
public List<String> getNodes()
ClusterManager
getNodes
in interface ClusterManager
public void nodeListener(NodeListener listener)
ClusterManager
nodeListener
in interface ClusterManager
public void join(Handler<AsyncResult<Void>> resultHandler)
ClusterManager
join
in interface ClusterManager
public void leave(Handler<AsyncResult<Void>> resultHandler)
ClusterManager
leave
in interface ClusterManager
public boolean isActive()
ClusterManager
isActive
in interface ClusterManager
public void childEvent(org.apache.curator.framework.CuratorFramework client, org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event) throws Exception
childEvent
in interface org.apache.curator.framework.recipes.cache.PathChildrenCacheListener
Exception
Copyright © 2023 Eclipse. All rights reserved.