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 Details

    • ACCESS_RPC_SERVICE_PERMISSION

      static final RuntimePermission 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 an RPCException will be thrown.
      Parameters:
      command - The command to execute on each cluster node
      synchronous - 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 of Serializable objects 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 the SecurityManager is installed and the call method doesn't have the RuntimePermission ACCESS_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 an RPCException will be thrown.
      Parameters:
      command - The command to execute on each cluster node
      timeout - a timeout after which to throw a replication exception.
      args - an array of Serializable objects 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 the SecurityManager is installed and the call method doesn't have the RuntimePermission ACCESS_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 an RPCException will be thrown.
      Parameters:
      command - The command to execute on the coordinator node
      synchronous - 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 of Serializable objects corresponding to parameters of the command to execute remotely
      Returns:
      the response of the coordinator.
      Throws:
      RPCException - in the event of problems.
      SecurityException - if the SecurityManager is installed and the call method doesn't have the RuntimePermission ACCESS_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 an RPCException will be thrown.
      Parameters:
      command - The command to execute on the coordinator node
      timeout - a timeout after which to throw a replication exception.
      args - an array of Serializable objects corresponding to parameters of the command to execute remotely
      Returns:
      the response of the coordinator.
      Throws:
      RPCException - in the event of problems.
      SecurityException - if the SecurityManager is installed and the call method doesn't have the RuntimePermission ACCESS_RPC_SERVICE_PERMISSION
    • registerCommand

      RemoteCommand registerCommand(RemoteCommand command) throws SecurityException
      Register a new RemoteCommand instance, 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 the RemoteCommand to register
      Returns:
      the command itself if it could be registered null otherwise
      Throws:
      SecurityException - if the SecurityManager is installed and the call method doesn't have the RuntimePermission ACCESS_RPC_SERVICE_PERMISSION
    • unregisterCommand

      void unregisterCommand(RemoteCommand command) throws SecurityException
      Unregister a RemoteCommand instance, 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 the SecurityManager is installed and the call method doesn't have the RuntimePermission ACCESS_RPC_SERVICE_PERMISSION
    • isCoordinator

      boolean isCoordinator() throws RPCException
      Indicates whether the local node is the coordinator of the cluster
      Returns:
      true if the coordinator is the coordinator, false otherwise throws RPCException in case the RPCService is in an illegal state
      Throws:
      RPCException
    • registerTopologyChangeListener

      void registerTopologyChangeListener(TopologyChangeListener listener) throws SecurityException
      Register a new TopologyChangeListener
      Parameters:
      listener - the listener to be registered
      Throws:
      SecurityException - if the SecurityManager is installed and the call method doesn't have the RuntimePermission ACCESS_RPC_SERVICE_PERMISSION
    • unregisterTopologyChangeListener

      void unregisterTopologyChangeListener(TopologyChangeListener listener) throws SecurityException
      Unregister a TopologyChangeListener if it exists
      Parameters:
      listener - the listener to unregister
      Throws:
      SecurityException - if the SecurityManager is installed and the call method doesn't have the RuntimePermission ACCESS_RPC_SERVICE_PERMISSION