Package de.xima.fc.cluster
Class ClusterManager
- java.lang.Object
-
- de.xima.fc.cluster.ClusterManager
-
public class ClusterManager extends Object
Manager for the cluster that can be used to control the cluster in a way that is independent of the implementation used for the clustering.- Since:
- 3.1.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose()Closes the cluster connection when previously opened viaopen().static voiddisconnect()Disconnect thegetLocaleNode()from the cluster.static IClusterConnectiongetConnection()static NodeModelgetLocaleNode()static booleanisClusterActivated()static booleanisConnectionActive()static booleanisLocaleNodeActive()static voidopen()Opens the cluster connection.static voidregisterCloseListener(IBaseNotificationListener listener)Registers a listener that is notified when the connection to the cluster isclosed.static voidregisterOpenListener(IBaseNotificationListener listener)Registers a listener that is notified when the connection to the cluster isopened.static voidrestart()Restarts the cluster (i.e.static voidstartup()Starts the cluster.
-
-
-
Method Detail
-
restart
public static void restart() throws ClusterOpenException- Throws:
ClusterOpenException- When the cluster could not be closed or started again.
-
startup
public static void startup() throws ClusterOpenExceptionStarts the cluster.- Throws:
ClusterOpenException- When the cluster could not be started.
-
open
public static void open() throws ClusterOpenExceptionOpens the cluster connection.- Throws:
ClusterOpenException- When the connection could not be opened.- See Also:
IClusterConnection.open()
-
close
public static void close()
Closes the cluster connection when previously opened viaopen().- See Also:
IClusterConnection.close()
-
disconnect
public static void disconnect()
Disconnect thegetLocaleNode()from the cluster.- See Also:
IClusterConnection.disconnect()
-
getConnection
public static IClusterConnection getConnection()
- Returns:
- The current connection to the cluster,
nullwhen not connected.
-
registerOpenListener
public static void registerOpenListener(IBaseNotificationListener listener)
Registers a listener that is notified when the connection to the cluster isopened.- Parameters:
listener- Listener to register.
-
registerCloseListener
public static void registerCloseListener(IBaseNotificationListener listener)
Registers a listener that is notified when the connection to the cluster isclosed.- Parameters:
listener- Listener to register.
-
isClusterActivated
public static boolean isClusterActivated()
- Returns:
- Whether clustering is enabled. When clustering is disabled,
startup()will not be possible.
-
isConnectionActive
public static boolean isConnectionActive()
- Returns:
- Whether the connection to the cluster is active.
-
getLocaleNode
public static NodeModel getLocaleNode()
- Returns:
- The local node, i.e. the node corresponding to the server running this code.
nullwhen no cluster connection is active.
-
isLocaleNodeActive
public static boolean isLocaleNodeActive()
- Returns:
- Whether the the
getLocaleNode()is active.
-
-