Package de.xima.fc.cluster.interfaces
Interface IClusterConnection
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
JGroupsClusterConnection
public interface IClusterConnection extends Closeable
Models the connection between nodes in the cluster.- Since:
- 3.1.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes the connection to other nodes.void
disconnect()
Disconnects the node from the cluster.IClusterChannelStateObserver
getChannelObserver()
ICluster
getCluster()
IClusterMessageObserver
getMessageObserver()
IClusterTopologyObserver
getTopologyObserver()
void
open()
Opens this connection.
-
-
-
Method Detail
-
open
void open() throws ClusterOpenException
Opens this connection. When no node exists yet, a new group is created. Otherwise, when a group exists already, joins that groups.- Throws:
ClusterOpenException
- When the connection could not be opened, such as due to a network failure etc.
-
close
void close()
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
-
disconnect
void disconnect()
Disconnects the node from the cluster. The node can join the cluster again later by callingopen()
.
-
getTopologyObserver
IClusterTopologyObserver getTopologyObserver()
- 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
IClusterChannelStateObserver getChannelObserver()
- 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
IClusterMessageObserver getMessageObserver()
- Returns:
- The observer that can be used to listen for messages sent between nodes.
-
getCluster
ICluster getCluster()
- Returns:
- The cluster to
-
-