Package de.xima.fc.cluster.impl.jgroup
Class JGroupsClusterConnection
- java.lang.Object
-
- de.xima.fc.cluster.impl.jgroup.JGroupsClusterConnection
-
- All Implemented Interfaces:
IClusterConnection
,Closeable
,Serializable
,AutoCloseable
public class JGroupsClusterConnection extends Object implements IClusterConnection, Serializable
Implementation of aIClusterConnection
that usesEClusterImplementation.JGROUPS
.- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JGroupsClusterConnection()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the connection to other nodes.static IClusterConnection
create()
Methode zum Erstellen einer JGroups-basiertenIClusterConnection
-Implementierungvoid
disconnect()
Disconnects the node from the cluster.IClusterChannelStateObserver
getChannelObserver()
ICluster
getCluster()
String
getClusterName()
IClusterMessageObserver
getMessageObserver()
String
getNodeName()
IClusterTopologyObserver
getTopologyObserver()
void
open()
Opens this connection.
-
-
-
Method Detail
-
create
public static IClusterConnection create()
Methode zum Erstellen einer JGroups-basiertenIClusterConnection
-Implementierung- Returns:
- an
IClusterConnection
-
open
public void open() throws ClusterOpenException
Description copied from interface:IClusterConnection
Opens this connection. When no node exists yet, a new group is created. Otherwise, when a group exists already, joins that groups.- Specified by:
open
in interfaceIClusterConnection
- Throws:
ClusterOpenException
- When the connection could not be opened, such as due to a network failure etc.
-
close
public void close()
Description copied from interface:IClusterConnection
Closes the connection to other nodes. This method closes the entire cluster, so that no more nodes can be added to the group.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceIClusterConnection
-
disconnect
public void disconnect()
Description copied from interface:IClusterConnection
Disconnects the node from the cluster. The node can join the cluster again later by callingIClusterConnection.open()
.- Specified by:
disconnect
in interfaceIClusterConnection
-
getTopologyObserver
public IClusterTopologyObserver getTopologyObserver()
- Specified by:
getTopologyObserver
in interfaceIClusterConnection
- Returns:
- The observer that can be used to listen for changes to the cluster topology (e.g. when a node is added or removed from the cluster).
-
getChannelObserver
public IClusterChannelStateObserver getChannelObserver()
- Specified by:
getChannelObserver
in interfaceIClusterConnection
- Returns:
- The observer that can be used to listen for changes to the channel state, e.g. when the connection to a node was established or cut, or the channel was closed.
-
getMessageObserver
public IClusterMessageObserver getMessageObserver()
- Specified by:
getMessageObserver
in interfaceIClusterConnection
- Returns:
- The observer that can be used to listen for messages sent between nodes.
-
getClusterName
public String getClusterName()
- Returns:
- The name of this cluster.
-
getNodeName
public String getNodeName()
- Returns:
- The name of the local node, i.e. the node corresponding to the server running this code.
-
getCluster
public ICluster getCluster()
- Specified by:
getCluster
in interfaceIClusterConnection
- Returns:
- The cluster to
-
-