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 ClusterManager
public void join(Handler<AsyncResult<Void>> resultHandler)
ClusterManager
join
in interface ClusterManager
public <K,V> void getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K,V>>> resultHandler)
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. cluster.xml in case of HazelcastClusterManager) for
additional MultiMap config parameters.resultHandler
- handler receiving the multimappublic 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 <K,V> void getAsyncMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
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 void leave(Handler<AsyncResult<Void>> resultHandler)
ClusterManager
leave
in interface ClusterManager
public void memberAdded(com.hazelcast.core.MembershipEvent membershipEvent)
memberAdded
in interface com.hazelcast.core.MembershipListener
public void memberRemoved(com.hazelcast.core.MembershipEvent membershipEvent)
memberRemoved
in interface com.hazelcast.core.MembershipListener
public void stateChanged(com.hazelcast.core.LifecycleEvent lifecycleEvent)
stateChanged
in interface com.hazelcast.core.LifecycleListener
public boolean isActive()
ClusterManager
isActive
in interface ClusterManager
public void memberAttributeChanged(com.hazelcast.core.MemberAttributeEvent memberAttributeEvent)
memberAttributeChanged
in interface com.hazelcast.core.MembershipListener
public 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 © 2023 Eclipse. All rights reserved.