Package de.xima.fc.cluster.impl.jgroup
Class JGroupsCluster
- All Implemented Interfaces:
ICluster
,Closeable
,Serializable
,AutoCloseable
,ConcurrentMap<String,
,NodeModel> Map<String,
,NodeModel> org.jgroups.blocks.ReplicatedMap<String,
,NodeModel> org.jgroups.Receiver
public class JGroupsCluster
extends org.jgroups.blocks.ReplicatedHashMap<String,NodeModel>
implements ICluster
Implementation of a
ICluster
that uses EClusterImplementation.JGROUPS
.- Since:
- 3.1.0
- Author:
- XIMA MEDIA GmbH
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.blocks.ReplicatedHashMap
org.jgroups.blocks.ReplicatedHashMap.Notification<K extends Object,
V extends Object> Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
Fields inherited from class org.jgroups.blocks.ReplicatedHashMap
call_options, disp, log, map, methods
-
Constructor Summary
ConstructorsConstructorDescriptionJGroupsCluster
(org.jgroups.JChannel channel, JGroupsClusterConnection clusterConnection) Creates a new JGroups cluster implementation. -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeLocaleNodeState
(ENodeState state) Changes the state of the local node, i.e. the node that corresponds to the server running this code.void
close()
void
Disconnects the channel of thisgetLocaleNode()
.getID()
String[]
void
Attempts to send a message to other nodes in the cluster.void
start()
Starts the cluster when not started yet.void
viewAccepted
(org.jgroups.View view) Methods inherited from class org.jgroups.blocks.ReplicatedHashMap
_clear, _put, _putAll, _putIfAbsent, _remove, _remove, _replace, _replace, addNotifier, clear, containsKey, containsValue, entrySet, get, getChannel, getClusterName, getLocalAddress, getState, getTimeout, init, isBlockingUpdates, put, putAll, putIfAbsent, remove, remove, removeNotifier, replace, replace, setBlockingUpdates, setState, setTimeout, start, stop, synchronizedMap
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, isEmpty, keySet, size, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
Methods inherited from interface org.jgroups.Receiver
block, receive, receive, unblock
-
Constructor Details
-
JGroupsCluster
Creates a new JGroups cluster implementation.- Parameters:
channel
- Channel to use for the local node.clusterConnection
- JGroups cluster connection to use.
-
-
Method Details
-
start
Starts the cluster when not started yet.- Throws:
Exception
- When the cluster could not be started.
-
viewAccepted
public void viewAccepted(org.jgroups.View view) -
getID
-
getNodeList
- Specified by:
getNodeList
in interfaceICluster
- Returns:
- All nodes that are part of the cluster, whether or not they are currently connected.
-
getNodeIDs
- Specified by:
getNodeIDs
in interfaceICluster
- Returns:
- A list of the IDs of all nodes that are part of the cluster, whether or not they are currently connected.
-
getLocaleNode
- Specified by:
getLocaleNode
in interfaceICluster
- Returns:
- The local node, i.e. the node that corresponds to the server running this code.
-
disconnect
public void disconnect()Disconnects the channel of thisgetLocaleNode()
. -
close
public void close() -
sendMessage
Description copied from interface:ICluster
Attempts to send a message to other nodes in the cluster.- Specified by:
sendMessage
in interfaceICluster
- Parameters:
msg
- Message to send to other nodes.- Throws:
Exception
- When the message could not be sent, such as due to network failures.
-
changeLocaleNodeState
Description copied from interface:ICluster
Changes the state of the local node, i.e. the node that corresponds to the server running this code.- Specified by:
changeLocaleNodeState
in interfaceICluster
- Parameters:
state
- The new state for the node.
-