public abstract class AbstractClusterManager extends Object implements IClusterManager
IClusterManager
,
independent of communication form.Modifier and Type | Field and Description |
---|---|
protected boolean |
processTransmissionsReceived
Indicates whether
transmissionReceived(IClusterTransmission)
processes the given transmission. |
protected String |
serverId
The identifier for this cluster node.
|
Constructor and Description |
---|
AbstractClusterManager() |
Modifier and Type | Method and Description |
---|---|
<T extends Serializable> |
callAndWaitResponses(IClusterCallable<T> command,
long timeout)
Calls a cluster command execution and waits all current cluster servers to respond with their result and, then, returns an
unmodifiable map having the cluster member as the key and the execution result as the value.
|
protected abstract <T extends Serializable> |
callAndWaitResponsesInternal(IClusterCallable<T> command,
long timeout) |
<T extends Serializable> |
createClusterCommand(IClusterCallable<T> callable)
Creates a cluster command instance and returns it.
|
IClusterCommand<Serializable> |
createClusterCommand(Runnable runnable)
Creates a cluster command instance and returns it.
|
IClusterMessage |
createClusterMessage(String group,
Serializable data)
Creates a cluster message instance and returns it.
|
void |
destroy()
Destroys the cluster manager.
|
void |
init()
Initializes the cluster manager.
|
protected <T extends Serializable> |
transmissionReceived(IClusterTransmission transmission)
Processes a received transmission.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
call, getClusterConfig, getLocalMember, getMembers, send
protected String serverId
protected boolean processTransmissionsReceived
transmissionReceived(IClusterTransmission)
processes the given transmission.protected <T extends Serializable> ITransmissionResult<T> transmissionReceived(IClusterTransmission transmission)
processTransmissionsReceived
may be used to disable the processing done by this method.transmission
- the transmission received.public void init()
IClusterManager
init
in interface IClusterManager
public void destroy()
IClusterManager
destroy
in interface IClusterManager
public IClusterCommand<Serializable> createClusterCommand(Runnable runnable)
IClusterManager
createClusterCommand
in interface IClusterManager
runnable
- the runnable that contains the command's execution. It must be serializable.IClusterCommand
public <T extends Serializable> IClusterCommand<T> createClusterCommand(IClusterCallable<T> callable)
IClusterManager
createClusterCommand
in interface IClusterManager
callable
- the IClusterCallable
that contains the command's execution. It must be serializable.public IClusterMessage createClusterMessage(String group, Serializable data)
IClusterManager
createClusterMessage
in interface IClusterManager
group
- the destination group for the message.data
- the data sent in the message.IClusterMessage
public <T extends Serializable> Map<IClusterMember,T> callAndWaitResponses(IClusterCallable<T> command, long timeout) throws ClusterInvocationException, TimeoutException, InterruptedException, IllegalArgumentException
IClusterManager
If some server raises an exception, a ClusterInvocationException
will be raised locally on the server that called this method
with all exceptions that happened in the servers as suppressed.
This method has no guarantee it will execute properly if cluster members enter or leave the cluster during its execution.
If all responses couldn't be retrieved in the given timeout, a TimeoutException
will be raised.
The given command must have been created through IClusterManager.createClusterCommand(IClusterCallable)
.
callAndWaitResponses
in interface IClusterManager
T
- the response type. it must be serializable.command
- the command to be invoked.timeout
- the timeout this method will wait the invoke finishes.ClusterInvocationException
- if some server raises an exception during the invoke.TimeoutException
- if the timeout has been reached and not all responses were returned.InterruptedException
- if the thread that called this method was interrupted.IllegalArgumentException
- if the given command is null
.protected abstract <T extends Serializable> Map<IClusterMember,T> callAndWaitResponsesInternal(IClusterCallable<T> command, long timeout) throws ClusterInvocationException, TimeoutException, InterruptedException
ClusterInvocationException
TimeoutException
InterruptedException
#callAndWaitResponses(IClusterCommand, long)
LumisXP 12.2.0.200122 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.