Package org.exoplatform.services.rpc
Interface RPCService
- All Known Implementing Classes:
AbstractRPCService,RPCServiceImpl
public interface RPCService
This service provides mechanism to communicate with the other cluster nodes. This service will
be based of JGroups as an underlying Transport.
- Version:
- $Id$
- Author:
- Nicolas Filotto
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RuntimePermissionThe permission needed to access to any methods of the RPCService -
Method Summary
Modifier and TypeMethodDescriptionexecuteCommandOnAllNodes(RemoteCommand command, boolean synchronous, Serializable... args) Executes a command on all the cluster nodes.executeCommandOnAllNodes(RemoteCommand command, long timeout, Serializable... args) Executes a command synchronously on all the cluster nodes.executeCommandOnCoordinator(RemoteCommand command, boolean synchronous, Serializable... args) Executes a command on the coordinator only.executeCommandOnCoordinator(RemoteCommand command, long timeout, Serializable... args) Executes a command synchronously on the coordinator only.booleanIndicates whether the local node is the coordinator of the clusterregisterCommand(RemoteCommand command) Register a newRemoteCommandinstance, it will be mapped to its id.voidRegister a newTopologyChangeListenervoidunregisterCommand(RemoteCommand command) Unregister aRemoteCommandinstance, if the id is known or the instance itself is known otherwise it will be ignoredvoidUnregister aTopologyChangeListenerif it exists
-
Field Details
-
ACCESS_RPC_SERVICE_PERMISSION
The permission needed to access to any methods of the RPCService
-
-
Method Details
-
executeCommandOnAllNodes
List<Object> executeCommandOnAllNodes(RemoteCommand command, boolean synchronous, Serializable... args) throws RPCException, SecurityException Executes a command on all the cluster nodes. This method is equivalent to the other method of the same type but with the default timeout. The command must be registered first otherwise anRPCExceptionwill be thrown.- Parameters:
command- The command to execute on each cluster nodesynchronous- if true, sets group request mode to org.jgroups.blocks.GroupRequest#GET_ALL, and if false sets it to org.jgroups.blocks.GroupRequest#GET_NONE.args- an array ofSerializableobjects corresponding to parameters of the command to execute remotely- Returns:
- a list of responses from all the members of the cluster. If we met an exception on a given node, the RPCException will be the corresponding response of this particular node
- Throws:
RPCException- in the event of problems.SecurityException- if theSecurityManageris installed and the call method doesn't have theRuntimePermissionACCESS_RPC_SERVICE_PERMISSION
-
executeCommandOnAllNodes
List<Object> executeCommandOnAllNodes(RemoteCommand command, long timeout, Serializable... args) throws RPCException, SecurityException Executes a command synchronously on all the cluster nodes. The command must be registered first otherwise anRPCExceptionwill be thrown.- Parameters:
command- The command to execute on each cluster nodetimeout- a timeout after which to throw a replication exception.args- an array ofSerializableobjects corresponding to parameters of the command to execute remotely- Returns:
- a list of responses from all the members of the cluster. If we met an exception on a given node, the RPCException will be the corresponding response of this particular node
- Throws:
RPCException- in the event of problems.SecurityException- if theSecurityManageris installed and the call method doesn't have theRuntimePermissionACCESS_RPC_SERVICE_PERMISSION
-
executeCommandOnCoordinator
Object executeCommandOnCoordinator(RemoteCommand command, boolean synchronous, Serializable... args) throws RPCException, SecurityException Executes a command on the coordinator only. This method is equivalent to the other method of the same type but with the default timeout. The command must be registered first otherwise anRPCExceptionwill be thrown.- Parameters:
command- The command to execute on the coordinator nodesynchronous- if true, sets group request mode to org.jgroups.blocks.GroupRequest#GET_ALL, and if false sets it to org.jgroups.blocks.GroupRequest#GET_NONE.args- an array ofSerializableobjects corresponding to parameters of the command to execute remotely- Returns:
- the response of the coordinator.
- Throws:
RPCException- in the event of problems.SecurityException- if theSecurityManageris installed and the call method doesn't have theRuntimePermissionACCESS_RPC_SERVICE_PERMISSION
-
executeCommandOnCoordinator
Object executeCommandOnCoordinator(RemoteCommand command, long timeout, Serializable... args) throws RPCException, SecurityException Executes a command synchronously on the coordinator only. The command must be registered first otherwise anRPCExceptionwill be thrown.- Parameters:
command- The command to execute on the coordinator nodetimeout- a timeout after which to throw a replication exception.args- an array ofSerializableobjects corresponding to parameters of the command to execute remotely- Returns:
- the response of the coordinator.
- Throws:
RPCException- in the event of problems.SecurityException- if theSecurityManageris installed and the call method doesn't have theRuntimePermissionACCESS_RPC_SERVICE_PERMISSION
-
registerCommand
Register a newRemoteCommandinstance, it will be mapped to its id. If a command with the same Id has already been registered, a warning will be printed into the log file and the new command will replace the old one.- Parameters:
command- the instance of theRemoteCommandto register- Returns:
- the command itself if it could be registered null otherwise
- Throws:
SecurityException- if theSecurityManageris installed and the call method doesn't have theRuntimePermissionACCESS_RPC_SERVICE_PERMISSION
-
unregisterCommand
Unregister aRemoteCommandinstance, if the id is known or the instance itself is known otherwise it will be ignored- Parameters:
command- the command to unregister- Throws:
SecurityException- if theSecurityManageris installed and the call method doesn't have theRuntimePermissionACCESS_RPC_SERVICE_PERMISSION
-
isCoordinator
Indicates whether the local node is the coordinator of the cluster- Returns:
trueif the coordinator is the coordinator,falseotherwise throws RPCException in case theRPCServiceis in an illegal state- Throws:
RPCException
-
registerTopologyChangeListener
Register a newTopologyChangeListener- Parameters:
listener- the listener to be registered- Throws:
SecurityException- if theSecurityManageris installed and the call method doesn't have theRuntimePermissionACCESS_RPC_SERVICE_PERMISSION
-
unregisterTopologyChangeListener
Unregister aTopologyChangeListenerif it exists- Parameters:
listener- the listener to unregister- Throws:
SecurityException- if theSecurityManageris installed and the call method doesn't have theRuntimePermissionACCESS_RPC_SERVICE_PERMISSION
-