Package lumis.portal.cluster
Class SingleServerClusterManager
- java.lang.Object
-
- lumis.portal.cluster.AbstractClusterManager
-
- lumis.portal.cluster.SingleServerClusterManager
-
- All Implemented Interfaces:
IClusterManager
public class SingleServerClusterManager extends AbstractClusterManager
The cluster manager implementation for single server (without cluster) deployment. In a single server environment the sending process triggers the receiving process immediately. As a consequence of this, the transmission consequences happens synchronously, but the same may not happen at a multi-server environment.- Since:
- 4.0.0
- Version:
- $Revision: 23904 $ $Date: 2020-06-16 12:23:44 -0300 (Tue, 16 Jun 2020) $
-
-
Field Summary
-
Fields inherited from class lumis.portal.cluster.AbstractClusterManager
processTransmissionsReceived, serverId, WAIT_LOCAL_PROCESSING_TIMEOUT_MS
-
-
Constructor Summary
Constructors Constructor Description SingleServerClusterManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Serializable>
Tcall(IClusterCommand<T> command)
Calls a cluster command execution and returns the result of the local execution.protected <T extends Serializable>
Map<IClusterMember,T>callAndWaitResponsesInternal(IClusterCallable<T> callable, long timeout)
void
destroy()
Destroys the cluster manager.IClusterConfig
getClusterConfig(ITransaction transaction)
Returns a persistent cluster configuration object.IClusterMember
getLocalMember()
Returns the current cluster member object.Collection<IClusterMember>
getMembers()
Returns a collection with information about the current members of this cluster.void
init()
Initializes the cluster manager.void
send(IClusterTransmission transmission)
Sends a transmission.-
Methods inherited from class lumis.portal.cluster.AbstractClusterManager
callAndWaitResponses, createClusterCommand, createClusterCommand, createClusterMessage, transmissionReceived
-
-
-
-
Method Detail
-
init
public void init()
Description copied from interface:IClusterManager
Initializes the cluster manager. This method should start the monitoring and connections necessary for the cluster manager to execute its communications.- Specified by:
init
in interfaceIClusterManager
- Overrides:
init
in classAbstractClusterManager
-
destroy
public void destroy()
Description copied from interface:IClusterManager
Destroys the cluster manager. This method should close all resources used by the cluster manager.- Specified by:
destroy
in interfaceIClusterManager
- Overrides:
destroy
in classAbstractClusterManager
-
send
public void send(IClusterTransmission transmission)
Description copied from interface:IClusterManager
Sends a transmission.- Parameters:
transmission
- the transmission. It must have been created using one of the factory methods available inIClusterManager
.- See Also:
IClusterManager.createClusterCommand(IClusterCallable)
,IClusterManager.createClusterMessage(String, Serializable)
-
call
public <T extends Serializable> T call(IClusterCommand<T> command) throws Exception
Description copied from interface:IClusterManager
Calls a cluster command execution and returns the result of the local execution.This method sends the command through the cluster and gives feedback on the local server execution, in the form of the return value and the raised exception.
It is important to notice that the command will be sent over the cluster despite its execution outcome.
The given command must have been created through
IClusterManager.createClusterCommand(IClusterCallable)
.- Parameters:
command
- the command to execute through the cluster.- Returns:
- the command execution outcome.
- Throws:
Exception
- the exception thrown during command execution or other unknown exception.
-
callAndWaitResponsesInternal
protected <T extends Serializable> Map<IClusterMember,T> callAndWaitResponsesInternal(IClusterCallable<T> callable, long timeout) throws ClusterInvocationException, TimeoutException, InterruptedException
- Specified by:
callAndWaitResponsesInternal
in classAbstractClusterManager
- Throws:
ClusterInvocationException
TimeoutException
InterruptedException
- See Also:
#callAndWaitResponses(IClusterCommand, long)
-
getMembers
public Collection<IClusterMember> getMembers()
Description copied from interface:IClusterManager
Returns a collection with information about the current members of this cluster.- Returns:
- a collection with information about the current members of this cluster.
-
getLocalMember
public IClusterMember getLocalMember()
Description copied from interface:IClusterManager
Returns the current cluster member object. The object returned represents the member where this method is executed on.- Returns:
- this server cluster member object.
-
getClusterConfig
public IClusterConfig getClusterConfig(ITransaction transaction) throws PortalException
Description copied from interface:IClusterManager
Returns a persistent cluster configuration object. The object contains the cluster configurations, and any changes will be applied on transaction commit.- Parameters:
transaction
- the transaction for persistence access.- Returns:
- a persistent cluster configuration instance.
- Throws:
PortalException
-
-