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 TypeMethodDescriptionvoidchangeLocaleNodeState(ENodeState state) Changes the state of the local node, i.e. the node that corresponds to the server running this code.voidclose()voidDisconnects the channel of thisgetLocaleNode().getID()String[]voidAttempts to send a message to other nodes in the cluster.voidstart()Starts the cluster when not started yet.voidviewAccepted(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, synchronizedMapMethods inherited from class java.util.AbstractMap
clone, equals, hashCode, isEmpty, keySet, size, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAllMethods 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:
getNodeListin interfaceICluster- Returns:
- All nodes that are part of the cluster, whether or not they are currently connected.
-
getNodeIDs
- Specified by:
getNodeIDsin 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:
getLocaleNodein 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:IClusterAttempts to send a message to other nodes in the cluster.- Specified by:
sendMessagein 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:IClusterChanges the state of the local node, i.e. the node that corresponds to the server running this code.- Specified by:
changeLocaleNodeStatein interfaceICluster- Parameters:
state- The new state for the node.
-