@StableMinor(version="12.0", sinceVersion="4.1") public interface IClusterManager
A message may be sent by creating it using createClusterMessage(String, Serializable)
and sending the IClusterMessage
object returned by calling
send(IClusterTransmission)
. When received, the message generates
a ClusterMessageReceivedEvent
.
A command may be sent by creating it using createClusterCommand(Runnable)
and sending the IClusterCommand
object returned by calling
send(IClusterTransmission)
. When received, the command executes
the corresponding Runnable
code.
Either the message or the command, can be further configured before sending by using the available methods in the returned object.
IClusterMessage
,
IClusterCommand
Modifier and Type | Method and Description |
---|---|
<T extends Serializable> |
call(IClusterCommand<T> command)
Calls a cluster command execution and returns the result of the local execution.
|
<T extends Serializable> |
createClusterCommand(IClusterCallable<T> callable)
Creates a cluster command instance and returns it.
|
IClusterCommand<Serializable> |
createClusterCommand(Runnable runnable)
Deprecated.
since 8.0.0 replaced by
createClusterCommand(IClusterCallable) . |
IClusterMessage |
createClusterMessage(String group,
Serializable data)
Creates a cluster message instance and returns it.
|
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.
|
void init()
void destroy()
void send(IClusterTransmission transmission)
transmission
- the transmission. It must have been created using
one of the factory methods available in IClusterManager
.createClusterCommand(IClusterCallable)
,
createClusterMessage(String, Serializable)
<T extends Serializable> T call(IClusterCommand<T> command) throws Exception
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 createClusterCommand(IClusterCallable)
.
command
- the command to execute through the cluster.Exception
- the exception thrown during command execution or other unknown exception.Collection<IClusterMember> getMembers() throws PortalException
PortalException
IClusterMember getLocalMember()
IClusterMessage createClusterMessage(String group, Serializable data)
group
- the destination group for the message.data
- the data sent in the message.IClusterMessage
@Deprecated IClusterCommand<Serializable> createClusterCommand(Runnable runnable)
createClusterCommand(IClusterCallable)
.runnable
- the runnable that contains the command's execution. It must be serializable.IClusterCommand
<T extends Serializable> IClusterCommand<T> createClusterCommand(IClusterCallable<T> callable)
callable
- the IClusterCallable
that contains the command's execution. It must be serializable.IClusterConfig getClusterConfig(ITransaction transaction) throws PortalException
transaction
- the transaction for persistence access.PortalException
LumisXP 12.0.0.190809 - Copyright © 2006–2019 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.