Infinispan Distribution 5.2.6.Final-redhat-2

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, Galder ZamarreƱo, Mircea.Markus@jboss.com

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.
 Address getAddress()
          Returns the address associated with this RpcManager or null if not part of the cluster.
 long getAverageReplicationTime()
           
 String getCommittedViewAsString()
           
 List<Address> getMembers()
          Returns members of a cluster scoped to the cache owning this RpcManager.
 String getPendingViewAsString()
           
 long getReplicationCount()
           
 long getReplicationFailures()
           
 String getSuccessRatio()
           
 double getSuccessRatioFloatingPoint()
           
 int getTopologyId()
          Returns the current topology id.
 Transport getTransport()
           
 void injectDependencies(Transport t, Cache cache, Configuration cfg, ReplicationQueue replicationQueue, CommandsFactory cf, ExecutorService e, LocalTopologyManager localTopologyManager, StateTransferManager stateTransferManager, GlobalConfiguration globalCfg)
           
 Map<Address,Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpc, boolean sync)
          Broadcasts an RPC command to a specified set of recipients
 Map<Address,Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpc, boolean sync, boolean usePriorityQueue)
          Broadcasts an RPC command to a specified set of recipients
 Map<Address,Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpc, boolean sync, boolean usePriorityQueue, long timeout)
           
 Map<Address,Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout)
          Invokes an RPC call on other caches in the cluster.
 Map<Address,Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout, boolean usePriorityQueue)
          Invokes an RPC call on other caches in the cluster.
 Map<Address,Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout, boolean usePriorityQueue, ResponseFilter responseFilter)
          Invokes an RPC call on other caches in the cluster.
 void invokeRemotelyInFuture(Collection<Address> recipients, ReplicableCommand rpc, boolean usePriorityQueue, NotifyingNotifiableFuture<Object> l)
          The same as RpcManager.invokeRemotely(java.util.Collection, org.infinispan.commands.ReplicableCommand, boolean) except that the task is passed to the transport executor and a Future is returned.
 void invokeRemotelyInFuture(Collection<Address> recipients, ReplicableCommand rpc, boolean usePriorityQueue, NotifyingNotifiableFuture<Object> l, long timeout)
          The same as RpcManager.invokeRemotelyInFuture(java.util.Collection, org.infinispan.commands.ReplicableCommand, boolean, org.infinispan.util.concurrent.NotifyingNotifiableFuture) except that you can specify a timeout.
 void invokeRemotelyInFuture(Collection<Address> recipients, ReplicableCommand rpc, boolean usePriorityQueue, NotifyingNotifiableFuture<Object> l, long timeout, boolean ignoreLeavers)
          The same as RpcManager.invokeRemotelyInFuture(java.util.Collection, org.infinispan.commands.ReplicableCommand, boolean, org.infinispan.util.concurrent.NotifyingNotifiableFuture, long) except that you can specify a response mode.
 void invokeRemotelyInFuture(Collection<Address> recipients, ReplicableCommand rpc, NotifyingNotifiableFuture<Object> l)
          The same as RpcManager.invokeRemotely(java.util.Collection, 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 setStatisticsEnabled(boolean statisticsEnabled)
          Deprecated. We already have an attribute, we shouldn't have an operation for the same thing.
 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,
                               Cache cache,
                               Configuration cfg,
                               ReplicationQueue replicationQueue,
                               CommandsFactory cf,
                               ExecutorService e,
                               LocalTopologyManager localTopologyManager,
                               StateTransferManager stateTransferManager,
                               GlobalConfiguration globalCfg)

getCommittedViewAsString

public String getCommittedViewAsString()

getPendingViewAsString

public String getPendingViewAsString()

invokeRemotely

public final Map<Address,Response> invokeRemotely(Collection<Address> recipients,
                                                  ReplicableCommand rpcCommand,
                                                  ResponseMode mode,
                                                  long timeout,
                                                  boolean usePriorityQueue,
                                                  ResponseFilter responseFilter)
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 map of responses from each member contacted.

invokeRemotely

public final Map<Address,Response> invokeRemotely(Collection<Address> recipients,
                                                  ReplicableCommand rpcCommand,
                                                  ResponseMode mode,
                                                  long timeout,
                                                  boolean usePriorityQueue)
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 map of responses from each member contacted.

invokeRemotely

public final Map<Address,Response> invokeRemotely(Collection<Address> recipients,
                                                  ReplicableCommand rpcCommand,
                                                  ResponseMode mode,
                                                  long timeout)
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 map of responses from each member contacted.

broadcastRpcCommand

public final void broadcastRpcCommand(ReplicableCommand rpc,
                                      boolean sync)
                               throws RpcException
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:
RpcException - in the event of problems

broadcastRpcCommand

public final void broadcastRpcCommand(ReplicableCommand rpc,
                                      boolean sync,
                                      boolean usePriorityQueue)
                               throws RpcException
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:
RpcException - 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 Map<Address,Response> invokeRemotely(Collection<Address> recipients,
                                                  ReplicableCommand rpc,
                                                  boolean sync)
                                           throws RpcException
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:
RpcException - in the event of problems

invokeRemotely

public final Map<Address,Response> invokeRemotely(Collection<Address> recipients,
                                                  ReplicableCommand rpc,
                                                  boolean sync,
                                                  boolean usePriorityQueue)
                                           throws RpcException
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:
RpcException - in the event of problems

invokeRemotely

public final Map<Address,Response> invokeRemotely(Collection<Address> recipients,
                                                  ReplicableCommand rpc,
                                                  boolean sync,
                                                  boolean usePriorityQueue,
                                                  long timeout)
                                           throws RpcException
Throws:
RpcException

invokeRemotelyInFuture

public final void invokeRemotelyInFuture(Collection<Address> recipients,
                                         ReplicableCommand rpc,
                                         NotifyingNotifiableFuture<Object> l)
Description copied from interface: RpcManager
The same as RpcManager.invokeRemotely(java.util.Collection, 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(Collection<Address> recipients,
                                         ReplicableCommand rpc,
                                         boolean usePriorityQueue,
                                         NotifyingNotifiableFuture<Object> l)
Description copied from interface: RpcManager
The same as RpcManager.invokeRemotely(java.util.Collection, 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

invokeRemotelyInFuture

public final void invokeRemotelyInFuture(Collection<Address> recipients,
                                         ReplicableCommand rpc,
                                         boolean usePriorityQueue,
                                         NotifyingNotifiableFuture<Object> l,
                                         long timeout)
Description copied from interface: RpcManager
The same as RpcManager.invokeRemotelyInFuture(java.util.Collection, org.infinispan.commands.ReplicableCommand, boolean, org.infinispan.util.concurrent.NotifyingNotifiableFuture) except that you can specify a timeout.

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
timeout - after which to give up (in millis)

invokeRemotelyInFuture

public void invokeRemotelyInFuture(Collection<Address> recipients,
                                   ReplicableCommand rpc,
                                   boolean usePriorityQueue,
                                   NotifyingNotifiableFuture<Object> l,
                                   long timeout,
                                   boolean ignoreLeavers)
Description copied from interface: RpcManager
The same as RpcManager.invokeRemotelyInFuture(java.util.Collection, org.infinispan.commands.ReplicableCommand, boolean, org.infinispan.util.concurrent.NotifyingNotifiableFuture, long) except that you can specify a response mode.

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
timeout - after which to give up (in millis)
ignoreLeavers - if true, recipients that leave or have already left the cluster are ignored if false, a SuspectException is thrown when a leave is detected

getTransport

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

resetStatistics

public void resetStatistics()

getReplicationCount

public long getReplicationCount()

getReplicationFailures

public long getReplicationFailures()

isStatisticsEnabled

public boolean isStatisticsEnabled()

setStatisticsEnabled

@Deprecated
public void setStatisticsEnabled(boolean statisticsEnabled)
Deprecated. We already have an attribute, we shouldn't have an operation for the same thing.


getSuccessRatio

public String getSuccessRatio()

getSuccessRatioFloatingPoint

public double getSuccessRatioFloatingPoint()

getAverageReplicationTime

public long getAverageReplicationTime()

setTransport

public void setTransport(Transport t)

getAddress

public Address getAddress()
Description copied from interface: RpcManager
Returns the address associated with this RpcManager or null if not part of the cluster.

Specified by:
getAddress in interface RpcManager

getTopologyId

public int getTopologyId()
Description copied from interface: RpcManager
Returns the current topology id. As opposed to the viewId which is updated whenever the cluster changes, the topologyId is updated when a new cache instance is started or removed - this doesn't necessarily coincide with a node being added/removed to the cluster.

Specified by:
getTopologyId in interface RpcManager

getMembers

public List<Address> getMembers()
Description copied from interface: RpcManager
Returns members of a cluster scoped to the cache owning this RpcManager. Note that this List is always a subset of Transport.getMembers()

Specified by:
getMembers in interface RpcManager
Returns:
a list of cache scoped cluster members

Infinispan Distribution 5.2.6.Final-redhat-2

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