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@jboss.org)

Nested Class Summary
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()
           
 org.jgroups.Address getLocalAddress()
          Retrieves the local JGroups channel's address
 List<org.jgroups.Address> getMembers()
          Returns a defensively copied list of members in the current cluster view.
 boolean isCoordinator()
           
 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

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

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

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.


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