public class HazelcastClusterManager extends Object implements ClusterManager, com.hazelcast.core.MembershipListener, com.hazelcast.core.LifecycleListener
| Constructor and Description |
|---|
HazelcastClusterManager()
Constructor - gets config from classpath
|
HazelcastClusterManager(com.hazelcast.config.Config conf)
Constructor - config supplied
|
HazelcastClusterManager(com.hazelcast.core.HazelcastInstance instance) |
| 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)
Every eventbus handler has an ID.
|
com.hazelcast.config.Config |
getConfig()
Get the Hazelcast config.
|
void |
getCounter(String name,
Handler<AsyncResult<Counter>> resultHandler) |
com.hazelcast.core.HazelcastInstance |
getHazelcastInstance() |
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
|
com.hazelcast.config.Config |
loadConfig()
Load Hazelcast config XML and transform it into a
Config object. |
void |
memberAdded(com.hazelcast.core.MembershipEvent membershipEvent) |
void |
memberAttributeChanged(com.hazelcast.core.MemberAttributeEvent memberAttributeEvent) |
void |
memberRemoved(com.hazelcast.core.MembershipEvent membershipEvent) |
void |
nodeListener(NodeListener listener)
Set a listener that will be called when a node joins or leaves the cluster.
|
void |
setConfig(com.hazelcast.config.Config config)
Set the Hazelcast config.
|
void |
setVertx(Vertx vertx) |
void |
stateChanged(com.hazelcast.core.LifecycleEvent lifecycleEvent) |
public HazelcastClusterManager()
public HazelcastClusterManager(com.hazelcast.config.Config conf)
conf - Hazelcast config, not nullpublic HazelcastClusterManager(com.hazelcast.core.HazelcastInstance instance)
public void setVertx(Vertx vertx)
setVertx in interface ClusterManagerpublic void join(Handler<AsyncResult<Void>> resultHandler)
ClusterManagerjoin in interface ClusterManagerpublic <K,V> void getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K,V>>> resultHandler)
getAsyncMultiMap in interface ClusterManagername - A unique name by which the the MultiMap can be identified within the cluster.
See the cluster config file (e.g. cluster.xml in case of HazelcastClusterManager) for
additional MultiMap config parameters.resultHandler - handler receiving the multimappublic String getNodeID()
ClusterManagergetNodeID in interface ClusterManagerpublic List<String> getNodes()
ClusterManagergetNodes in interface ClusterManagerpublic void nodeListener(NodeListener listener)
ClusterManagernodeListener in interface ClusterManagerpublic <K,V> void getAsyncMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
ClusterManagergetAsyncMap in interface ClusterManagerpublic <K,V> Map<K,V> getSyncMap(String name)
ClusterManagergetSyncMap in interface ClusterManagerpublic void getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler)
getLockWithTimeout in interface ClusterManagerpublic void getCounter(String name, Handler<AsyncResult<Counter>> resultHandler)
getCounter in interface ClusterManagerpublic void leave(Handler<AsyncResult<Void>> resultHandler)
ClusterManagerleave in interface ClusterManagerpublic void memberAdded(com.hazelcast.core.MembershipEvent membershipEvent)
memberAdded in interface com.hazelcast.core.MembershipListenerpublic void memberRemoved(com.hazelcast.core.MembershipEvent membershipEvent)
memberRemoved in interface com.hazelcast.core.MembershipListenerpublic void stateChanged(com.hazelcast.core.LifecycleEvent lifecycleEvent)
stateChanged in interface com.hazelcast.core.LifecycleListenerpublic boolean isActive()
ClusterManagerisActive in interface ClusterManagerpublic void memberAttributeChanged(com.hazelcast.core.MemberAttributeEvent memberAttributeEvent)
memberAttributeChanged in interface com.hazelcast.core.MembershipListenerpublic com.hazelcast.config.Config getConfig()
public void setConfig(com.hazelcast.config.Config config)
config - a config objectpublic com.hazelcast.config.Config loadConfig()
Config object.
The content is read from:
vertx.hazelcast.config sysprop, if present, orcluster.xml file on the classpath, if present, orThe cluster manager uses this method to load the config when the node joins the cluster, if no config was provided upon creation.
You may use this method to get a base config and customize it before the node joins the cluster.
In this case, don't forget to invoke setConfig(Config) after you applied your changes.
public com.hazelcast.core.HazelcastInstance getHazelcastInstance()
Copyright © 2021 Eclipse. All rights reserved.