org.jboss.ha.framework.interfaces
Interface HAPartition


public interface HAPartition

HAPartition is an abstraction of the communication framework, providing access to clustered services such as Distributed State, Distributed Replicant Manager and RPC.

Version:
$Revision: 75636 $

Revisions:

28.07.2002 - Sacha Labourey:

Author:
Bill Burke., Sacha Labourey., Galder Zamarreno

Nested Class Summary
static interface HAPartition.AsynchHAMembershipExtendedListener
          A tagging interface for HAMembershipExtendedListener callbacks that will be performed in a thread separate from the JG protocol handler thread.
static interface HAPartition.AsynchHAMembershipListener
          A tagging interface for HAMembershipListener callbacks that will be performed in a thread separate from the JG protocol handler thread.
static interface HAPartition.HAMembershipExtendedListener
          Extends HAMembershipListener to receive notification when a network-partition merge occurs.
static interface HAPartition.HAMembershipListener
          When a new node joins the cluster or an existing node leaves the cluster (or simply dies), membership events are raised.
static interface HAPartition.HAPartitionStateTransfer
          State management is highly important for clustered services.
 
Method Summary
 void callAsynchMethodOnCluster(String serviceName, String methodName, Object[] args, Class[] types, boolean excludeSelf)
          Invoke a asynchronous RPC call on all nodes of the partition/cluster.
 void callAsyncMethodOnNode(String serviceName, String methodName, Object[] args, Class[] types, long methodTimeout, ClusterNode targetNode)
          Calls method on target node only.
 ArrayList callMethodOnCluster(String serviceName, String methodName, Object[] args, Class[] types, boolean excludeSelf)
          Invoke a synchronous RPC call on all nodes of the partition/cluster
 ArrayList callMethodOnCluster(String serviceName, String methodName, Object[] args, Class[] types, boolean excludeSelf, ResponseFilter filter)
          Invoke a synchronous RPC call on all nodes of the partition/cluster which can be terminated early based on response filter implementation passed.
 ArrayList callMethodOnCoordinatorNode(String serviceName, String methodName, Object[] args, Class[] types, boolean excludeSelf)
          Calls method on Cluster coordinator node only.
 Object callMethodOnNode(String serviceName, String methodName, Object[] args, Class[] types, long methodTimeout, ClusterNode targetNode)
          Calls method synchronously on target node only.
 boolean getAllowSynchronousMembershipNotifications()
          Returns whether this partition will synchronously notify any HAMembershipListeners of membership changes using the calling thread from the underlying ClusterPartition.
 ClusterNode getClusterNode()
          Return member node for the current cluster node.
 ClusterNode[] getClusterNodes()
          Return the member nodes that built the current view i.e., the current partition.
 Vector getCurrentView()
          Return the list of member nodes that built the current view i.e., the current partition.
 long getCurrentViewId()
          Each time the partition topology changes, a new view is computed.
 DistributedReplicantManager getDistributedReplicantManager()
          Accessor to the DistributedReplicantManager (DRM) that is linked to this partition.
 DistributedState getDistributedStateService()
          Deprecated. Use JBoss Cache for distributed caching
 String getNodeName()
          Return the name of this node in the current partition.
 String getPartitionName()
          The name of the partition.
 void registerMembershipListener(HAPartition.HAMembershipListener listener)
          Subscribes to receive HAPartition.HAMembershipListener events.
 void registerRPCHandler(String serviceName, Object handler)
          The partition receives RPC calls from other nodes in the cluster and demultiplexes them, according to a service name, to a particular service.
 void registerRPCHandler(String serviceName, Object handler, ClassLoader classloader)
          The partition receives RPC calls from other nodes in the cluster and demultiplexes them, according to a service name, to a particular service.
 void setAllowSynchronousMembershipNotifications(boolean allowSync)
          Sets whether this partition will synchronously notify any HAMembershipListeners of membership changes using the calling thread from the underlying ClusterPartition.
 void subscribeToStateTransferEvents(String serviceName, HAPartition.HAPartitionStateTransfer subscriber)
          Register a service that will participate in state transfer protocol and receive callbacks
 void unregisterMembershipListener(HAPartition.HAMembershipListener listener)
          Unsubscribes from receiving HAPartition.HAMembershipListener events.
 void unregisterRPCHandler(String serviceName, Object subscriber)
          Unregister the service from the partition
 void unsubscribeFromStateTransferEvents(String serviceName, HAPartition.HAPartitionStateTransfer subscriber)
          Unregister a service from state transfer callbacks.
 

Method Detail

getNodeName

String getNodeName()
Return the name of this node in the current partition. The name is dynamically determined by the partition. The name will be the String returned by getClusterNode().getName().

Returns:
The node name
See Also:
getClusterNode()

getPartitionName

String getPartitionName()
The name of the partition. Either set when creating the partition (MBEAN definition) or uses the default name

Returns:
Name of the current partition

getDistributedReplicantManager

DistributedReplicantManager getDistributedReplicantManager()
Accessor to the DistributedReplicantManager (DRM) that is linked to this partition.

Returns:
the DistributedReplicantManager

getDistributedStateService

DistributedState getDistributedStateService()
Deprecated. Use JBoss Cache for distributed caching

Accessor to the DistributedState (DS) that is linked to this partition.

Returns:
the DistributedState service

registerRPCHandler

void registerRPCHandler(String serviceName,
                        Object handler)
The partition receives RPC calls from other nodes in the cluster and demultiplexes them, according to a service name, to a particular service. Consequently, each service must first subscribe with a particular service name in the partition. The subscriber does not need to implement any specific interface: the call is handled dynamically through reflection.

Parameters:
serviceName - Name of the subscribing service (demultiplexing key)
handler - object to be called when receiving a RPC for its key.

registerRPCHandler

void registerRPCHandler(String serviceName,
                        Object handler,
                        ClassLoader classloader)
The partition receives RPC calls from other nodes in the cluster and demultiplexes them, according to a service name, to a particular service. Consequently, each service must first subscribe with a particular service name in the partition. The subscriber does not need to implement any specific interface: the call is handled dynamically through reflection. In cases where the client is using a scoped classloader, the client will need to provide a reference to the classloader if the service's RPC calls use custom parameter or response object types. The classloader will be used to deserialize the RPC and/or response.

Parameters:
serviceName - Name of the subscribing service (demultiplexing key)
handler - object to be called when receiving a RPC for its key.
classloader - ClassLoader to be used when marshalling and unmarshalling RPC requests and responses.

unregisterRPCHandler

void unregisterRPCHandler(String serviceName,
                          Object subscriber)
Unregister the service from the partition

Parameters:
serviceName - Name of the service key (on which the demultiplexing occurs)
subscriber - The target object that unsubscribes

callMethodOnCluster

ArrayList callMethodOnCluster(String serviceName,
                              String methodName,
                              Object[] args,
                              Class[] types,
                              boolean excludeSelf)
                              throws Exception
Invoke a synchronous RPC call on all nodes of the partition/cluster

Parameters:
serviceName - Name of the target service name on which calls are de-multiplexed
methodName - name of the Java method to be called on remote services
args - array of Java Object representing the set of parameters to be given to the remote method
types - The types of the parameters
excludeSelf - indicates if the RPC must also be made on the current node of the partition or only on remote nodes
Returns:
an array of responses from remote nodes
Throws:
Exception - Throws if a communication exception occurs

callMethodOnCluster

ArrayList callMethodOnCluster(String serviceName,
                              String methodName,
                              Object[] args,
                              Class[] types,
                              boolean excludeSelf,
                              ResponseFilter filter)
                              throws Exception
Invoke a synchronous RPC call on all nodes of the partition/cluster which can be terminated early based on response filter implementation passed.

Parameters:
serviceName - Name of the target service name on which calls are de-multiplexed
methodName - Name of the Java method to be called on remote services
args - Array of Java Object representing the set of parameters to be given to the remote method
types - The types of the parameters
excludeSelf - Indicates if the RPC must also be made on the current node of the partition or only on remote nodes
filter - Response filter instance which allows for early termination of the synchronous RCP call.
Returns:
an array of responses from remote nodes
Throws:
Exception - Throws if a communication exception occurs

callAsynchMethodOnCluster

void callAsynchMethodOnCluster(String serviceName,
                               String methodName,
                               Object[] args,
                               Class[] types,
                               boolean excludeSelf)
                               throws Exception
Invoke a asynchronous RPC call on all nodes of the partition/cluster. The call will return immediately and will not wait for the nodes to answer. Thus no answer is available.

Parameters:
serviceName - Name of the target service name on which calls are de-multiplexed
methodName - name of the Java method to be called on remote services
args - array of Java Object representing the set of parameters to be given to the remote method
types - The types of the parameters
excludeSelf - indicates if the RPC must also be made on the current node of the partition or only on remote nodes
Throws:
Exception - Throws if a communication exception occurs

callMethodOnCoordinatorNode

ArrayList callMethodOnCoordinatorNode(String serviceName,
                                      String methodName,
                                      Object[] args,
                                      Class[] types,
                                      boolean excludeSelf)
                                      throws Exception
Calls method on Cluster coordinator node only. The cluster coordinator node is the first node in the current cluster view.

Parameters:
serviceName - Name of the target service name on which calls are de-multiplexed
methodName - name of the Java method to be called on remote services
args - array of Java Object representing the set of parameters to be given to the remote method
types - The types of the parameters
excludeSelf - indicates if the RPC will be made on the current node even if the current node is the coordinator
Returns:
an array of responses from remote nodes
Throws:
Exception - Throws if a communication exception occurs

callMethodOnNode

Object callMethodOnNode(String serviceName,
                        String methodName,
                        Object[] args,
                        Class[] types,
                        long methodTimeout,
                        ClusterNode targetNode)
                        throws Throwable
Calls method synchronously on target node only.

Parameters:
serviceName - Name of the target service name on which calls are de-multiplexed
methodName - name of the Java method to be called on remote services
args - array of Java Object representing the set of parameters to be given to the remote method
types - The types of the parameters node of the partition or only on remote nodes
targetNode - is the target of the call
Returns:
the value returned by the target method
Throws:
Exception - Throws if a communication exception occurs
Throwable

callAsyncMethodOnNode

void callAsyncMethodOnNode(String serviceName,
                           String methodName,
                           Object[] args,
                           Class[] types,
                           long methodTimeout,
                           ClusterNode targetNode)
                           throws Throwable
Calls method on target node only.

Parameters:
serviceName - Name of the target service name on which calls are de-multiplexed
methodName - name of the Java method to be called on remote services
args - array of Java Object representing the set of parameters to be given to the remote method
types - The types of the parameters node of the partition or only on remote nodes
targetNode - is the target of the call
Throws:
Exception - Throws if a communication exception occurs
Throwable

subscribeToStateTransferEvents

void subscribeToStateTransferEvents(String serviceName,
                                    HAPartition.HAPartitionStateTransfer subscriber)
Register a service that will participate in state transfer protocol and receive callbacks

Parameters:
serviceName - Name of the service that subscribes for state transfer events. This name must be identical for all identical services in the cluster.
subscriber - Object implementing HAPartition.HAPartitionStateTransfer and providing or receiving state transfer callbacks

unsubscribeFromStateTransferEvents

void unsubscribeFromStateTransferEvents(String serviceName,
                                        HAPartition.HAPartitionStateTransfer subscriber)
Unregister a service from state transfer callbacks.

Parameters:
serviceName - Name of the service that participates in the state transfer protocol
subscriber - Service implementing the state transfer callback methods

registerMembershipListener

void registerMembershipListener(HAPartition.HAMembershipListener listener)
Subscribes to receive HAPartition.HAMembershipListener events.

Parameters:
listener - The membership listener object

unregisterMembershipListener

void unregisterMembershipListener(HAPartition.HAMembershipListener listener)
Unsubscribes from receiving HAPartition.HAMembershipListener events.

Parameters:
listener - The listener wishing to unsubscribe

getAllowSynchronousMembershipNotifications

boolean getAllowSynchronousMembershipNotifications()
Returns whether this partition will synchronously notify any HAMembershipListeners of membership changes using the calling thread from the underlying ClusterPartition.

Returns:
true if registered listeners that don't implement AsynchHAMembershipExtendedListener or AsynchHAMembershipListener will be notified synchronously of membership changes; false if those listeners will be notified asynchronously. Default is false.

setAllowSynchronousMembershipNotifications

void setAllowSynchronousMembershipNotifications(boolean allowSync)
Sets whether this partition will synchronously notify any HAMembershipListeners of membership changes using the calling thread from the underlying ClusterPartition.

Parameters:
allowSync - true if registered listeners that don't implement AsynchHAMembershipExtendedListener or AsynchHAMembershipListener should be notified synchronously of membership changes; false if those listeners can be notified asynchronously. Default is false.

getCurrentViewId

long getCurrentViewId()
Each time the partition topology changes, a new view is computed. A view is a list of members, the first member being the coordinator of the view. Each view also has a distinct identifier.

Returns:
The identifier of the current view

getCurrentView

Vector getCurrentView()
Return the list of member nodes that built the current view i.e., the current partition.

Returns:
An array of Strings containing the node names

getClusterNodes

ClusterNode[] getClusterNodes()
Return the member nodes that built the current view i.e., the current partition.

Returns:
An array of ClusterNode listing the current members of the partition. This array will be in the same order in all nodes in the cluster that have received the current view.

getClusterNode

ClusterNode getClusterNode()
Return member node for the current cluster node.

Returns:
ClusterNode containing the current node name


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