public class HazelcastClusterManager extends Object implements ClusterManager, com.hazelcast.cluster.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 |
|---|---|
void |
addRegistration(String address,
RegistrationInfo registrationInfo,
Promise<Void> promise)
Share a new messaging handler registration with other nodes in the cluster.
|
String |
clusterHost()
If the cluster manager has its own server for data/membership, this returns the host it is listening to.
|
String |
clusterPublicHost()
If the cluster manager has its own server for data/membership, this returns the host it advertises to other nodes.
|
<K,V> void |
getAsyncMap(String name,
Promise<AsyncMap<K,V>> promise)
Return an
AsyncMap for the given name. |
com.hazelcast.config.Config |
getConfig()
Get the Hazelcast config.
|
void |
getCounter(String name,
Promise<Counter> promise)
Return a
Counter for the given name. |
com.hazelcast.core.HazelcastInstance |
getHazelcastInstance() |
void |
getLockWithTimeout(String name,
long timeout,
Promise<Lock> promise)
|
String |
getNodeId()
Return the unique node identifier for this node.
|
NodeInfo |
getNodeInfo()
Get details about this clustered node.
|
void |
getNodeInfo(String nodeId,
Promise<NodeInfo> promise)
Get details about a specific node in the cluster.
|
List<String> |
getNodes()
Return a list of node identifiers corresponding to the nodes in the cluster.
|
void |
getRegistrations(String address,
Promise<List<RegistrationInfo>> promise)
Get the messaging handler currently registered in the cluster.
|
<K,V> Map<K,V> |
getSyncMap(String name)
Return a synchronous map for the given
name. |
void |
init(Vertx vertx,
NodeSelector nodeSelector)
Invoked before this cluster node tries to join the cluster.
|
boolean |
isActive()
Is the cluster manager active?
|
void |
join(Promise<Void> promise)
Join the cluster.
|
void |
leave(Promise<Void> promise)
Leave the cluster.
|
com.hazelcast.config.Config |
loadConfig()
Load Hazelcast config XML and transform it into a
Config object. |
void |
memberAdded(com.hazelcast.cluster.MembershipEvent membershipEvent) |
void |
memberRemoved(com.hazelcast.cluster.MembershipEvent membershipEvent) |
void |
nodeListener(NodeListener listener)
Set a listener that will be called when a node joins or leaves the cluster.
|
void |
removeRegistration(String address,
RegistrationInfo registrationInfo,
Promise<Void> promise)
Signal removal of a messaging handler registration to other nodes in the cluster.
|
void |
setConfig(com.hazelcast.config.Config config)
Set the Hazelcast config.
|
void |
setNodeInfo(NodeInfo nodeInfo,
Promise<Void> promise)
Store the details about this clustered node.
|
void |
stateChanged(com.hazelcast.core.LifecycleEvent lifecycleEvent) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitpublic HazelcastClusterManager()
public HazelcastClusterManager(com.hazelcast.config.Config conf)
conf - Hazelcast config, not nullpublic HazelcastClusterManager(com.hazelcast.core.HazelcastInstance instance)
public void init(Vertx vertx, NodeSelector nodeSelector)
ClusterManager
Implementations must signal the provided nodeSelector when messaging handler registrations are added or removed
by sending a RegistrationUpdateEvent with NodeSelector.registrationsUpdated(RegistrationUpdateEvent).
init in interface ClusterManagervertx - the Vert.x instancenodeSelector - the NodeSelector that must receive RegistrationUpdateEvent.public void join(Promise<Void> promise)
ClusterManagerjoin in interface ClusterManagerpublic String getNodeId()
ClusterManagergetNodeId in interface ClusterManagerpublic List<String> getNodes()
ClusterManagergetNodes in interface ClusterManagerpublic void nodeListener(NodeListener listener)
ClusterManagernodeListener in interface ClusterManagerpublic void setNodeInfo(NodeInfo nodeInfo, Promise<Void> promise)
ClusterManagersetNodeInfo in interface ClusterManagerpublic NodeInfo getNodeInfo()
ClusterManagergetNodeInfo in interface ClusterManagerpublic void getNodeInfo(String nodeId, Promise<NodeInfo> promise)
ClusterManagergetNodeInfo in interface ClusterManagernodeId - the clustered node idpublic <K,V> void getAsyncMap(String name, Promise<AsyncMap<K,V>> promise)
ClusterManagerAsyncMap for the given name.getAsyncMap in interface ClusterManagerpublic <K,V> Map<K,V> getSyncMap(String name)
ClusterManagername.getSyncMap in interface ClusterManagerpublic void getLockWithTimeout(String name, long timeout, Promise<Lock> promise)
ClusterManagergetLockWithTimeout in interface ClusterManagerpublic void getCounter(String name, Promise<Counter> promise)
ClusterManagerCounter for the given name.getCounter in interface ClusterManagerpublic void leave(Promise<Void> promise)
ClusterManagerleave in interface ClusterManagerpublic void memberAdded(com.hazelcast.cluster.MembershipEvent membershipEvent)
memberAdded in interface com.hazelcast.cluster.MembershipListenerpublic void memberRemoved(com.hazelcast.cluster.MembershipEvent membershipEvent)
memberRemoved in interface com.hazelcast.cluster.MembershipListenerpublic void stateChanged(com.hazelcast.core.LifecycleEvent lifecycleEvent)
stateChanged in interface com.hazelcast.core.LifecycleListenerpublic boolean isActive()
ClusterManagerisActive in interface ClusterManagerpublic void addRegistration(String address, RegistrationInfo registrationInfo, Promise<Void> promise)
ClusterManageraddRegistration in interface ClusterManagerpublic void removeRegistration(String address, RegistrationInfo registrationInfo, Promise<Void> promise)
ClusterManagerremoveRegistration in interface ClusterManagerpublic void getRegistrations(String address, Promise<List<RegistrationInfo>> promise)
ClusterManagergetRegistrations in interface ClusterManagerpublic String clusterHost()
ClusterManagerclusterHost in interface ClusterManagerpublic String clusterPublicHost()
ClusterManagerclusterPublicHost in interface ClusterManagerpublic 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 © 2022 Eclipse. All rights reserved.