org.jboss.cache
Interface RPCManager

All Known Implementing Classes:
RPCManagerImpl

public interface RPCManager

Provides a mechanism for communicating with other caches in the cluster. For now this is based on JGroups as an underlying transport, and in future more transport options may become available.

Implementations have a simple lifecycle:

Since:
2.1.0
Author:
Manik Surtani

Method Summary
 List<Object> callRemoteMethods(Vector<org.jgroups.Address> recipients, ReplicableCommand cacheCommand, 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 cacheCommand, 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 cacheCommand, 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
 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.
 

Method Detail

disconnect

void disconnect()
Disconnects and closes the underlying JGroups channel.


stop

void stop()
Stops the RPCDispatcher and frees resources. Closes and disconnects the underlying JGroups channel if this is still open/connected.


start

void start()
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.


callRemoteMethods

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

Parameters:
recipients - a list of Addresses to invoke the call on. If this is null, the call is broadcast to the entire cluster.
cacheCommand - 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.

callRemoteMethods

List<Object> callRemoteMethods(Vector<org.jgroups.Address> recipients,
                               ReplicableCommand cacheCommand,
                               int mode,
                               long timeout,
                               boolean useOutOfBandMessage)
                               throws Exception
Invokes an RPC call on other caches in the cluster.

Parameters:
recipients - a list of Addresses to invoke the call on. If this is null, the call is broadcast to the entire cluster.
cacheCommand - 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

List<Object> callRemoteMethods(Vector<org.jgroups.Address> recipients,
                               ReplicableCommand cacheCommand,
                               boolean synchronous,
                               long timeout,
                               boolean useOutOfBandMessage)
                               throws Exception
Invokes an RPC call on other caches in the cluster.

Parameters:
recipients - a list of Addresses to invoke the call on. If this is null, the call is broadcast to the entire cluster.
cacheCommand - 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.

isCoordinator

boolean isCoordinator()
Returns:
true if the current Channel is the coordinator of the cluster.

getCoordinator

org.jgroups.Address getCoordinator()
Returns:
the Address of the current coordinator.

getLocalAddress

org.jgroups.Address getLocalAddress()
Retrieves the local JGroups channel's address

Returns:
an Address

getMembers

List<org.jgroups.Address> getMembers()
Returns a defensively copied list of members in the current cluster view.


fetchPartialState

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

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

void fetchPartialState(List<org.jgroups.Address> sources,
                       Fqn subtree)
                       throws Exception
Retrieves partial state from remote instances.

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

getChannel

org.jgroups.Channel getChannel()
Retrieves the Channel

Returns:
a channel

getLastStateTransferSource

org.jgroups.Address getLastStateTransferSource()
Returns the last state transfer source address.

Returns:
the last state transfer source address

getFlushTracker

RPCManagerImpl.FlushTracker getFlushTracker()
Returns the flush tracker associated with this manager.

Returns:
the current flush tracker


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