Package org.exoplatform.services.rpc
Interface RPCService
-
- All Known Implementing Classes:
AbstractRPCService,RPCServiceImpl
public interface RPCServiceThis 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
Fields Modifier and Type Field Description static RuntimePermissionACCESS_RPC_SERVICE_PERMISSIONThe permission needed to access to any methods of the RPCService
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<Object>executeCommandOnAllNodes(RemoteCommand command, boolean synchronous, Serializable... args)Executes a command on all the cluster nodes.List<Object>executeCommandOnAllNodes(RemoteCommand command, long timeout, Serializable... args)Executes a command synchronously on all the cluster nodes.ObjectexecuteCommandOnCoordinator(RemoteCommand command, boolean synchronous, Serializable... args)Executes a command on the coordinator only.ObjectexecuteCommandOnCoordinator(RemoteCommand command, long timeout, Serializable... args)Executes a command synchronously on the coordinator only.booleanisCoordinator()Indicates whether the local node is the coordinator of the clusterRemoteCommandregisterCommand(RemoteCommand command)Register a newRemoteCommandinstance, it will be mapped to its id.voidregisterTopologyChangeListener(TopologyChangeListener listener)Register a newTopologyChangeListenervoidunregisterCommand(RemoteCommand command)Unregister aRemoteCommandinstance, if the id is known or the instance itself is known otherwise it will be ignoredvoidunregisterTopologyChangeListener(TopologyChangeListener listener)Unregister aTopologyChangeListenerif it exists
-
-
-
Field Detail
-
ACCESS_RPC_SERVICE_PERMISSION
static final RuntimePermission ACCESS_RPC_SERVICE_PERMISSION
The permission needed to access to any methods of the RPCService
-
-
Method Detail
-
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
RemoteCommand registerCommand(RemoteCommand command) throws SecurityException
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
void unregisterCommand(RemoteCommand command) throws SecurityException
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
boolean isCoordinator() throws RPCExceptionIndicates 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
void registerTopologyChangeListener(TopologyChangeListener listener) throws SecurityException
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
void unregisterTopologyChangeListener(TopologyChangeListener listener) throws SecurityException
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
-
-