org.jboss.cache
Class RPCManagerImpl

java.lang.Object
  extended by org.jboss.cache.RPCManagerImpl
All Implemented Interfaces:
RPCManager

public class RPCManagerImpl
extends Object
implements RPCManager

Manager that handles all RPC calls between JBoss Cache instances

Author:
Manik Surtani (manik AT jboss DOT org)

Nested Class Summary
 class RPCManagerImpl.FlushTracker
           
protected  class RPCManagerImpl.MembershipListenerAdaptor
           
 
Constructor Summary
RPCManagerImpl()
           
 
Method Summary
 List<Object> callRemoteMethods(Vector<org.jgroups.Address> recipients, ReplicableCommand command, boolean synchronous, long timeout, boolean useOutOfBandMessage)
          Invokes an RPC call on other caches in the cluster.
 List<Object> callRemoteMethods(Vector<org.jgroups.Address> recipients, ReplicableCommand command, int mode, long timeout, boolean useOutOfBandMessage)
          Invokes an RPC call on other caches in the cluster.
 List<Object> callRemoteMethods(Vector<org.jgroups.Address> recipients, ReplicableCommand command, int mode, long timeout, org.jgroups.blocks.RspFilter responseFilter, boolean useOutOfBandMessage)
          Invokes an RPC call on other caches in the cluster.
 void disconnect()
          Disconnects and closes the underlying JGroups channel.
 void fetchPartialState(List<org.jgroups.Address> sources, Fqn subtree)
          Retrieves partial state from remote instances.
 void fetchPartialState(List<org.jgroups.Address> sources, Fqn sourceTarget, Fqn integrationTarget)
          Retrieves partial state from remote instances.
 org.jgroups.Channel getChannel()
          Retrieves the Channel
 org.jgroups.Address getCoordinator()
           
 RPCManagerImpl.FlushTracker getFlushTracker()
          Returns the flush tracker associated with this manager.
 org.jgroups.Address getLastStateTransferSource()
          Returns the last state transfer source address.
 org.jgroups.Address getLocalAddress()
          Retrieves the local JGroups channel's address
 String getLocalAddressString()
           
 List<org.jgroups.Address> getMembers()
          Returns a defensively copied list of members in the current cluster view.
 String getMembersString()
           
 long getReplicationCount()
           
 long getReplicationFailures()
           
 String getSuccessRatio()
           
 boolean isCoordinator()
           
 boolean isEnabled()
           
 boolean isStatisticsEnabled()
           
 void resetStatistics()
           
 void setStatisticsEnabled(boolean statisticsEnabled)
           
 void setupDependencies(ChannelMessageListener messageListener, Configuration configuration, Notifier notifier, CacheSPI spi, Marshaller marshaller, TransactionTable txTable, TransactionManager txManager, InvocationContextContainer container, InterceptorChain interceptorChain, ComponentRegistry componentRegistry, LockManager lockManager)
           
 void start()
          Starts the RPCManager by connecting the underlying JGroups channel (if configured for replication).
 void stop()
          Stops the RPCDispatcher and frees resources.
 
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

setupDependencies

public void setupDependencies(ChannelMessageListener messageListener,
                              Configuration configuration,
                              Notifier notifier,
                              CacheSPI spi,
                              Marshaller marshaller,
                              TransactionTable txTable,
                              TransactionManager txManager,
                              InvocationContextContainer container,
                              InterceptorChain interceptorChain,
                              ComponentRegistry componentRegistry,
                              LockManager lockManager)

start

public void start()
Description copied from interface: RPCManager
Starts the RPCManager by connecting the underlying JGroups channel (if configured for replication). Connecting the channel may also involve state transfer (if configured) so the interceptor chain should be started and available before this method is called.

Specified by:
start in interface RPCManager

disconnect

public void disconnect()
Description copied from interface: RPCManager
Disconnects and closes the underlying JGroups channel.

Specified by:
disconnect in interface RPCManager

stop

public void stop()
Description copied from interface: RPCManager
Stops the RPCDispatcher and frees resources. Closes and disconnects the underlying JGroups channel if this is still open/connected.

Specified by:
stop in interface RPCManager

getChannel

public org.jgroups.Channel getChannel()
Description copied from interface: RPCManager
Retrieves the Channel

Specified by:
getChannel in interface RPCManager
Returns:
a channel

callRemoteMethods

public List<Object> callRemoteMethods(Vector<org.jgroups.Address> recipients,
                                      ReplicableCommand command,
                                      int mode,
                                      long timeout,
                                      boolean useOutOfBandMessage)
                               throws Exception
Description copied from interface: RPCManager
Invokes an RPC call on other caches in the cluster.

Specified by:
callRemoteMethods 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.
command - the cache command to invoke
mode - the group request mode to use. See GroupRequest.
timeout - a timeout after which to throw a replication exception.
useOutOfBandMessage - if true, the message is put on JGroups' OOB queue. See JGroups docs for more info.
Returns:
a list of responses from each member contacted.
Throws:
Exception - in the event of problems.

callRemoteMethods

public List<Object> callRemoteMethods(Vector<org.jgroups.Address> recipients,
                                      ReplicableCommand command,
                                      boolean synchronous,
                                      long timeout,
                                      boolean useOutOfBandMessage)
                               throws Exception
Description copied from interface: RPCManager
Invokes an RPC call on other caches in the cluster.

Specified by:
callRemoteMethods 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.
command - the cache command to invoke
synchronous - if true, sets group request mode to GroupRequest.GET_ALL, and if false sets it to GroupRequest.GET_NONE.
timeout - a timeout after which to throw a replication exception.
useOutOfBandMessage - if true, the message is put on JGroups' OOB queue. See JGroups docs for more info.
Returns:
a list of responses from each member contacted.
Throws:
Exception - in the event of problems.

callRemoteMethods

public List<Object> callRemoteMethods(Vector<org.jgroups.Address> recipients,
                                      ReplicableCommand command,
                                      int mode,
                                      long timeout,
                                      org.jgroups.blocks.RspFilter responseFilter,
                                      boolean useOutOfBandMessage)
                               throws Exception
Description copied from interface: RPCManager
Invokes an RPC call on other caches in the cluster.

Specified by:
callRemoteMethods 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.
command - the cache command to invoke
mode - the group request mode to use. See GroupRequest.
timeout - a timeout after which to throw a replication exception.
responseFilter - a response filter with which to filter out failed/unwanted/invalid responses.
useOutOfBandMessage - if true, the message is put on JGroups' OOB queue. See JGroups docs for more info.
Returns:
a list of responses from each member contacted.
Throws:
Exception - in the event of problems.

fetchPartialState

public void fetchPartialState(List<org.jgroups.Address> sources,
                              Fqn sourceTarget,
                              Fqn integrationTarget)
                       throws Exception
Description copied from interface: RPCManager
Retrieves partial state from remote instances.

Specified by:
fetchPartialState in interface RPCManager
Parameters:
sources - sources to consider for a state transfer
sourceTarget - Fqn on source to retrieve state for
integrationTarget - integration point on local cache to apply state
Throws:
Exception - in the event of problems

fetchPartialState

public void fetchPartialState(List<org.jgroups.Address> sources,
                              Fqn subtree)
                       throws Exception
Description copied from interface: RPCManager
Retrieves partial state from remote instances.

Specified by:
fetchPartialState in interface RPCManager
Parameters:
sources - sources to consider for a state transfer
subtree - Fqn subtree to retrieve. Will be integrated at the same point.
Throws:
Exception - in the event of problems

getLocalAddressString

public String getLocalAddressString()

getLastStateTransferSource

public org.jgroups.Address getLastStateTransferSource()
Description copied from interface: RPCManager
Returns the last state transfer source address.

Specified by:
getLastStateTransferSource in interface RPCManager
Returns:
the last state transfer source address

getLocalAddress

public org.jgroups.Address getLocalAddress()
Description copied from interface: RPCManager
Retrieves the local JGroups channel's address

Specified by:
getLocalAddress in interface RPCManager
Returns:
an Address

getMembersString

public String getMembersString()

getMembers

public List<org.jgroups.Address> getMembers()
Description copied from interface: RPCManager
Returns a defensively copied list of members in the current cluster view.

Specified by:
getMembers in interface RPCManager

isCoordinator

public boolean isCoordinator()
Specified by:
isCoordinator in interface RPCManager
Returns:
true if the current Channel is the coordinator of the cluster.

getCoordinator

public org.jgroups.Address getCoordinator()
Specified by:
getCoordinator in interface RPCManager
Returns:
the Address of the current coordinator.

resetStatistics

public void resetStatistics()

getReplicationCount

public long getReplicationCount()

getReplicationFailures

public long getReplicationFailures()

isStatisticsEnabled

public boolean isStatisticsEnabled()

isEnabled

public boolean isEnabled()

setStatisticsEnabled

public void setStatisticsEnabled(boolean statisticsEnabled)

getSuccessRatio

public String getSuccessRatio()

getFlushTracker

public RPCManagerImpl.FlushTracker getFlushTracker()
Description copied from interface: RPCManager
Returns the flush tracker associated with this manager.

Specified by:
getFlushTracker in interface RPCManager
Returns:
the current flush tracker


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