org.infinispan.remoting.rpc
Class RpcManagerImpl

java.lang.Object
  extended by org.infinispan.remoting.rpc.RpcManagerImpl
All Implemented Interfaces:
RpcManager

public class RpcManagerImpl
extends Object
implements RpcManager

This component really is just a wrapper around a Transport implementation, and is used to set up the transport and provide lifecycle and dependency hooks into external transport implementations.

Since:
4.0
Author:
Manik Surtani

Constructor Summary
RpcManagerImpl()
           
 
Method Summary
 void broadcastRpcCommand(ReplicableCommand rpc, boolean sync)
          Broadcasts an RPC command to the entire cluster.
 void broadcastRpcCommand(ReplicableCommand rpc, boolean sync, boolean usePriorityQueue)
          Broadcasts an RPC command to the entire cluster.
 void broadcastRpcCommandInFuture(ReplicableCommand rpc, boolean usePriorityQueue, NotifyingNotifiableFuture<Object> l)
          The same as RpcManager.broadcastRpcCommand(org.infinispan.commands.ReplicableCommand, boolean, boolean) except that the task is passed to the transport executor and a Future is returned.
 void broadcastRpcCommandInFuture(ReplicableCommand rpc, NotifyingNotifiableFuture<Object> l)
          The same as RpcManager.broadcastRpcCommand(org.infinispan.commands.ReplicableCommand, boolean) except that the task is passed to the transport executor and a Future is returned.
 String getAddress()
           
 Address getCurrentStateTransferSource()
          If RpcManager.retrieveState(String, long) has been invoked and hasn't yet returned (i.e., a state transfer is in progress), this method will return the current Address from which a state transfer is being attempted.
 String getMembers()
           
 String getReplicationCount()
           
 String getReplicationFailures()
           
 String getSuccessRatio()
           
 Transport getTransport()
           
 void injectDependencies(Transport t, Configuration configuration, ReplicationQueue replicationQueue, CommandsFactory cf, ExecutorService e)
           
 void invokeRemotely(List<Address> recipients, ReplicableCommand rpc, boolean sync)
          Broadcasts an RPC command to a specified set of recipients
 void invokeRemotely(List<Address> recipients, ReplicableCommand rpc, boolean sync, boolean usePriorityQueue)
          Broadcasts an RPC command to a specified set of recipients
 List<Response> invokeRemotely(List<Address> recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout)
          Invokes an RPC call on other caches in the cluster.
 List<Response> invokeRemotely(List<Address> recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout, boolean usePriorityQueue)
          Invokes an RPC call on other caches in the cluster.
 List<Response> invokeRemotely(List<Address> recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout, boolean usePriorityQueue, ResponseFilter responseFilter)
          Invokes an RPC call on other caches in the cluster.
 void invokeRemotelyInFuture(List<Address> recipients, ReplicableCommand rpc, boolean usePriorityQueue, NotifyingNotifiableFuture<Object> l)
          The same as RpcManager.invokeRemotely(java.util.List, org.infinispan.commands.ReplicableCommand, boolean) except that the task is passed to the transport executor and a Future is returned.
 void invokeRemotelyInFuture(List<Address> recipients, ReplicableCommand rpc, NotifyingNotifiableFuture<Object> l)
          The same as RpcManager.invokeRemotely(java.util.List, org.infinispan.commands.ReplicableCommand, boolean) except that the task is passed to the transport executor and a Future is returned.
 boolean isStatisticsEnabled()
           
 void resetStatistics()
           
 void retrieveState(String cacheName, long timeout)
          Initiates a state retrieval process from neighbouring caches.
 void setStatisticsEnabled(boolean statisticsEnabled)
           
 void setTransport(Transport t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RpcManagerImpl

public RpcManagerImpl()
Method Detail

injectDependencies

public void injectDependencies(Transport t,
                               Configuration configuration,
                               ReplicationQueue replicationQueue,
                               CommandsFactory cf,
                               ExecutorService e)

invokeRemotely

public final List<Response> invokeRemotely(List<Address> recipients,
                                           ReplicableCommand rpcCommand,
                                           ResponseMode mode,
                                           long timeout,
                                           boolean usePriorityQueue,
                                           ResponseFilter responseFilter)
                                    throws Exception
Description copied from interface: RpcManager
Invokes an RPC call on other caches in the cluster.

Specified by:
invokeRemotely in interface RpcManager
Parameters:
recipients - a list of Addresses to invoke the call on. If this is null, the call is broadcast to the entire cluster.
rpcCommand - the cache command to invoke
mode - the response mode to use
timeout - a timeout after which to throw a replication exception.
usePriorityQueue - if true, a priority queue is used to deliver messages. May not be supported by all implementations.
responseFilter - a response filter with which to filter out failed/unwanted/invalid responses.
Returns:
a list of responses from each member contacted.
Throws:
Exception - in the event of problems.

invokeRemotely

public final List<Response> invokeRemotely(List<Address> recipients,
                                           ReplicableCommand rpcCommand,
                                           ResponseMode mode,
                                           long timeout,
                                           boolean usePriorityQueue)
                                    throws Exception
Description copied from interface: RpcManager
Invokes an RPC call on other caches in the cluster.

Specified by:
invokeRemotely in interface RpcManager
Parameters:
recipients - a list of Addresses to invoke the call on. If this is null, the call is broadcast to the entire cluster.
rpcCommand - the cache command to invoke
mode - the response mode to use
timeout - a timeout after which to throw a replication exception.
usePriorityQueue - if true, a priority queue is used to deliver messages. May not be supported by all implementations.
Returns:
a list of responses from each member contacted.
Throws:
Exception - in the event of problems.

invokeRemotely

public final List<Response> invokeRemotely(List<Address> recipients,
                                           ReplicableCommand rpcCommand,
                                           ResponseMode mode,
                                           long timeout)
                                    throws Exception
Description copied from interface: RpcManager
Invokes an RPC call on other caches in the cluster.

Specified by:
invokeRemotely in interface RpcManager
Parameters:
recipients - a list of Addresses to invoke the call on. If this is null, the call is broadcast to the entire cluster.
rpcCommand - the cache command to invoke
mode - the response mode to use
timeout - a timeout after which to throw a replication exception.
Returns:
a list of responses from each member contacted.
Throws:
Exception - in the event of problems.

retrieveState

public void retrieveState(String cacheName,
                          long timeout)
                   throws StateTransferException
Description copied from interface: RpcManager
Initiates a state retrieval process from neighbouring caches. This method will block until it either times out, or state is retrieved and applied.

Specified by:
retrieveState in interface RpcManager
Parameters:
cacheName - name of cache requesting state
timeout - length of time to try to retrieve state on each peer
Throws:
StateTransferException - in the event of problems

broadcastRpcCommand

public final void broadcastRpcCommand(ReplicableCommand rpc,
                                      boolean sync)
                               throws ReplicationException
Description copied from interface: RpcManager
Broadcasts an RPC command to the entire cluster.

Specified by:
broadcastRpcCommand in interface RpcManager
Parameters:
rpc - command to execute remotely
sync - if true, the transport will operate in sync mode. Otherwise, it will operate in async mode.
Throws:
ReplicationException - in the event of problems

broadcastRpcCommand

public final void broadcastRpcCommand(ReplicableCommand rpc,
                                      boolean sync,
                                      boolean usePriorityQueue)
                               throws ReplicationException
Description copied from interface: RpcManager
Broadcasts an RPC command to the entire cluster.

Specified by:
broadcastRpcCommand in interface RpcManager
Parameters:
rpc - command to execute remotely
sync - if true, the transport will operate in sync mode. Otherwise, it will operate in async mode.
usePriorityQueue - if true, a priority queue is used
Throws:
ReplicationException - in the event of problems

broadcastRpcCommandInFuture

public final void broadcastRpcCommandInFuture(ReplicableCommand rpc,
                                              NotifyingNotifiableFuture<Object> l)
Description copied from interface: RpcManager
The same as RpcManager.broadcastRpcCommand(org.infinispan.commands.ReplicableCommand, boolean) except that the task is passed to the transport executor and a Future is returned. The transport always deals with this synchronously.

Specified by:
broadcastRpcCommandInFuture in interface RpcManager
Parameters:
rpc - command to execute remotely
l - the future which will be passed back to the user

broadcastRpcCommandInFuture

public final void broadcastRpcCommandInFuture(ReplicableCommand rpc,
                                              boolean usePriorityQueue,
                                              NotifyingNotifiableFuture<Object> l)
Description copied from interface: RpcManager
The same as RpcManager.broadcastRpcCommand(org.infinispan.commands.ReplicableCommand, boolean, boolean) except that the task is passed to the transport executor and a Future is returned. The transport always deals with this synchronously.

Specified by:
broadcastRpcCommandInFuture in interface RpcManager
Parameters:
rpc - command to execute remotely
usePriorityQueue - if true, a priority queue is used
l - the future which will be passed back to the user

invokeRemotely

public final void invokeRemotely(List<Address> recipients,
                                 ReplicableCommand rpc,
                                 boolean sync)
                          throws ReplicationException
Description copied from interface: RpcManager
Broadcasts an RPC command to a specified set of recipients

Specified by:
invokeRemotely in interface RpcManager
Parameters:
recipients - recipients to invoke remote command on
rpc - command to execute remotely
sync - if true, the transport will operate in sync mode. Otherwise, it will operate in async mode.
Throws:
ReplicationException - in the event of problems

invokeRemotely

public final void invokeRemotely(List<Address> recipients,
                                 ReplicableCommand rpc,
                                 boolean sync,
                                 boolean usePriorityQueue)
                          throws ReplicationException
Description copied from interface: RpcManager
Broadcasts an RPC command to a specified set of recipients

Specified by:
invokeRemotely in interface RpcManager
Parameters:
recipients - recipients to invoke remote command on
rpc - command to execute remotely
sync - if true, the transport will operate in sync mode. Otherwise, it will operate in async mode.
usePriorityQueue - if true, a priority queue is used
Throws:
ReplicationException - in the event of problems

invokeRemotelyInFuture

public final void invokeRemotelyInFuture(List<Address> recipients,
                                         ReplicableCommand rpc,
                                         NotifyingNotifiableFuture<Object> l)
Description copied from interface: RpcManager
The same as RpcManager.invokeRemotely(java.util.List, org.infinispan.commands.ReplicableCommand, boolean) except that the task is passed to the transport executor and a Future is returned. The transport always deals with this synchronously.

Specified by:
invokeRemotelyInFuture in interface RpcManager
Parameters:
recipients - recipients to invoke remote call on
rpc - command to execute remotely
l - the future which will be passed back to the user

invokeRemotelyInFuture

public final void invokeRemotelyInFuture(List<Address> recipients,
                                         ReplicableCommand rpc,
                                         boolean usePriorityQueue,
                                         NotifyingNotifiableFuture<Object> l)
Description copied from interface: RpcManager
The same as RpcManager.invokeRemotely(java.util.List, org.infinispan.commands.ReplicableCommand, boolean) except that the task is passed to the transport executor and a Future is returned. The transport always deals with this synchronously.

Specified by:
invokeRemotelyInFuture in interface RpcManager
Parameters:
recipients - recipients to invoke remote call on
rpc - command to execute remotely
usePriorityQueue - if true, a priority queue is used
l - the future which will be passed back to the user

getTransport

public Transport getTransport()
Specified by:
getTransport in interface RpcManager
Returns:
a reference to the underlying transport.

getCurrentStateTransferSource

public Address getCurrentStateTransferSource()
Description copied from interface: RpcManager
If RpcManager.retrieveState(String, long) has been invoked and hasn't yet returned (i.e., a state transfer is in progress), this method will return the current Address from which a state transfer is being attempted. Otherwise, this method returns a null.

Specified by:
getCurrentStateTransferSource in interface RpcManager
Returns:
the current Address from which a state transfer is being attempted, if a state transfer is in progress, or a null otherwise.

resetStatistics

public void resetStatistics()

getReplicationCount

public String getReplicationCount()

getReplicationFailures

public String getReplicationFailures()

isStatisticsEnabled

public boolean isStatisticsEnabled()

setStatisticsEnabled

public void setStatisticsEnabled(boolean statisticsEnabled)

getAddress

public String getAddress()

getMembers

public String getMembers()

getSuccessRatio

public String getSuccessRatio()

setTransport

public void setTransport(Transport t)


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.