[jboss-cvs] JBossAS SVN: r104414 - projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 4 01:10:56 EDT 2010
Author: bstansberry at jboss.com
Date: 2010-05-04 01:10:55 -0400 (Tue, 04 May 2010)
New Revision: 104414
Modified:
projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/HAPartition.java
Log:
[JBCLUSTER-139] Create HAPartition super-interfaces
Modified: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/HAPartition.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/HAPartition.java 2010-05-04 03:19:44 UTC (rev 104413)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/HAPartition.java 2010-05-04 05:10:55 UTC (rev 104414)
@@ -22,6 +22,7 @@
package org.jboss.ha.framework.interfaces;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
@@ -42,7 +43,7 @@
* </ul>
*/
-public interface HAPartition
+public interface HAPartition extends GroupRpcDispatcher, GroupMembershipNotifier, GroupStateTransferService
{
// *******************************
// *******************************
@@ -86,49 +87,6 @@
// RPC multicast communication
// ***************************
// ***************************
-
- /**
- * Gets the default period, in ms, that the various <code>callMethodOnXXX</code>
- * methods that don't specify a <code>methodTimeout</code> parameter will wait for a response.
- */
- public long getMethodCallTimeout();
-
- /**
- * Register an object upon which RPCs associated with the given serviceName
- * will be invoked.
- * 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.
- * @param serviceName Name of the subscribing service (demultiplexing key)
- * @param handler object to be called when receiving a RPC for its key.
- */
- public void registerRPCHandler(String serviceName, Object handler);
-
- /**
- * Register an object upon which RPCs associated with the given serviceName
- * will be invoked.
- * 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.
- * @param serviceName Name of the subscribing service (demultiplexing key)
- * @param handler object to be called when receiving a RPC for its key.
- * @param classloader ClassLoader to be used when marshalling and unmarshalling RPC requests and responses.
- */
- public void registerRPCHandler(String serviceName, Object handler, ClassLoader classloader);
-
- /**
- * Unregister the service from the partition
- * @param serviceName Name of the service key (on which the demultiplexing occurs)
- * @param subscriber The target object that unsubscribes
- */
- public void unregisterRPCHandler(String serviceName, Object subscriber);
/**
@@ -147,8 +105,12 @@
* node of the partition, <code>true</code> if only on remote nodes
*
* @return an array of responses from nodes that invoked the RPC
+ *
+ * @deprecated Use {@link GroupRpcDispatcher#callMethodOnCluster(String, String, Object[], Class[], boolean) the superinterface version}
*/
- public List<?> callMethodOnCluster(String serviceName, String methodName,
+ @Deprecated
+ @Override
+ public ArrayList<?> callMethodOnCluster(String serviceName, String methodName,
Object[] args, Class<?>[] types, boolean excludeSelf) throws InterruptedException;
/**
@@ -169,259 +131,13 @@
* of the synchronous RPC call. Can be <code>null</code>.
*
* @return an array of responses from remote nodes
- */
- public List<?> callMethodOnCluster(String serviceName, String methodName,
- Object[] args, Class<?>[] types, boolean excludeSelf, ResponseFilter filter) throws InterruptedException;
-
- /**
- * Invoke an RPC call on all nodes of the partition/cluster and return their
- * response values as a list.
*
- * @param T the expected type of the return values
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param returnType the expected type of the return values, null or
- * <code>void.class</code> if no return values are expected
- * @param excludeSelf <code>false</code> if the RPC must also be made on the current
- * node of the partition, <code>true</code> if only on remote nodes
- * @param filter response filter instance which allows for early termination
- * of the RPC call once acceptable responses are received. Can be <code>null</code>,
- * in which the call will not return until all nodes have responded.
- * @param methodTimeout max number of ms to wait for response to arrive before
- * returning
- * @param unordered <code>true</code> if the HAPartition isn't required to ensure
- * that this RPC is invoked on all nodes in a consistent order with respect
- * to other RPCs originated by the same node
- * @return a list of responses from remote nodes
+ * @deprecated Use {@link GroupRpcDispatcher#callMethodOnCluster(String, String, Object[], Class[], boolean, ResponseFilter) the superinterface version}
*/
- public <T> List<T> callMethodOnCluster(String serviceName, String methodName,
- Object[] args, Class<?>[] types, Class<T> returnType, boolean excludeSelf,
- ResponseFilter filter, long methodTimeout, boolean unordered) throws InterruptedException;
-
- /**
- * Invoke an RPC call on all nodes of the partition/cluster without waiting
- * for any responses. The call will return immediately after sending a message
- * to the cluster telling nodes to invoke the RPC and will not wait for the nodes to answer. Thus
- * no return values are available. This convenience method is equivalent to
- * {@link #callAsynchMethodOnCluster(String, String, Object[], Class[], boolean, boolean)
- * callAsynchMethodOnCluster(serviceName, methodName, args, types, excludeSelf, false)}.
- *
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param excludeSelf <code>false</code> if the RPC must also be made on the current
- * node of the partition, <code>true</code> if only on remote nodes
- */
- public void callAsynchMethodOnCluster (String serviceName, String methodName,
- Object[] args, Class<?>[] types, boolean excludeSelf) throws InterruptedException;
-
- /**
- * Invoke an RPC call on all nodes of the partition/cluster without waiting
- * for any responses. The call will return immediately after sending a message
- * to the cluster telling nodes to invoke the RPC and will not wait for the nodes to answer.
- * Thus no return values are available.
- *
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param excludeSelf <code>false</code> if the RPC must also be made on the current
- * node of the partition, <code>true</code> if only on remote nodes
- * @param unordered <code>true</code> if the HAPartition isn't required to ensure
- * that this RPC is invoked on all nodes in a consistent order with respect
- * to other RPCs originated by the same node
- */
- public void callAsynchMethodOnCluster(String serviceName, String methodName,
- Object[] args, Class<?>[] types, boolean excludeSelf, boolean unordered) throws InterruptedException;
-
- /**
- * Calls method on Cluster coordinator node only. The cluster coordinator
- * node is the first node in the current cluster view. This convenience method is equivalent to
- * {@link #callMethodOnCoordinatorNode(String, String, Object[], Class[], Class, boolean, long, boolean)
- * callMethodOnCoordinatorNode(serviceName, methodName, args, types, Object.class, excludeSelf, methodTimeout, false)}
- * where <code>methodTimeout</code> is the value returned by {@link #getMethodCallTimeout()}.
- *
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param excludeSelf <code>true</code> if the RPC should not be made on the
- * current node even if the current node is the coordinator
- *
- * @return the value returned by the target method
- */
- public Object 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.
- *
- * @param T the expected type of the return value
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param returnType the expected type of the return value, <code>null</code>
- * or <code>void.class</code> if no return value is expected
- * @param excludeSelf <code>true</code> if the RPC should not be made on the
- * current node even if the current node is the coordinator
- * @param methodTimeout max number of ms to wait for response to arrive before
- * returning
- * @param unordered <code>true</code> if the HAPartition isn't required to ensure
- * that this RPC is invoked on all nodes in a consistent order with respect
- * to other RPCs originated by the same node
- * @return the value returned by the target method
- */
- public <T> T callMethodOnCoordinatorNode(String serviceName, String methodName,
- Object[] args, Class<?>[] types, Class<T> returnType, boolean excludeSelf,
- long methodTimeout, boolean unordered) throws Exception;
-
-
- /**
- * Calls method on target node only. This convenience method is equivalent to
- * {@link #callMethodOnNode(String, String, Object[], Class[], Class, long, ClusterNode, boolean)
- * callMethodOnNode(serviceName, methodName, args, types, Object.class, methodTimeout, targetNode, false)}
- * where <code>methodTimeout</code> is the value returned by {@link #getMethodCallTimeout()}.
- *
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param methodTimeout max number of ms to wait for response to arrive before
- * returning
- * @param targetNode is the target of the call
- *
- * @return the value returned by the target method
- */
- public Object callMethodOnNode(String serviceName, String methodName,
- Object[] args, Class<?>[] types, ClusterNode targetNode) throws Exception;
-
-
- /**
- * Calls method on target node only. This convenience method is equivalent to
- * {@link #callMethodOnNode(String, String, Object[], Class[], Class, long, ClusterNode, boolean)
- * callMethodOnNode(serviceName, methodName, args, types, Object.class, methodTimeout, targetNode, false)}.
- *
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param methodTimeout max number of ms to wait for response to arrive before
- * returning
- * @param targetNode is the target of the call
- *
- * @return the value returned by the target method
- */
- public Object callMethodOnNode(String serviceName, String methodName,
- Object[] args, Class<?>[] types, long methodTimeout, ClusterNode targetNode) throws Exception;
-
-
- /**
- * Calls method synchronously on target node only.
- *
- * @param T the expected type of the return value
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param returnType the expected type of the return value, <code>null</code>
- * or <code>void.class</code> if no return value is expected
- * @param methodTimeout max number of ms to wait for response to arrive before
- * returning
- * @param targetNode is the target of the call
- * @param unordered <code>true</code> if the HAPartition isn't required to ensure
- * that this RPC is invoked on all nodes in a consistent order with respect
- * to other RPCs originated by the same node
- * @return the value returned by the target method
- */
- public <T> T callMethodOnNode(String serviceName, String methodName,
- Object[] args, Class<?>[] types, Class<T> returnType,
- long methodTimeout, ClusterNode targetNode, boolean unordered) throws Exception;
-
- /**
- * Calls method on target node only. The call will return immediately and
- * will not wait for the node to answer. Thus no answer is available. This
- * convenience method is equivalent to
- * {@link #callAsynchMethodOnNode(String, String, Object[], Class[], ClusterNode, boolean)
- * callAsynchMethodOnCluster(serviceName, methodName, args, types, methodTimeout, targetNode, false)}.
- *
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param targetNode is the target of the call
- */
- public void callAsyncMethodOnNode(String serviceName, String methodName,
- Object[] args, Class<?>[] types, ClusterNode targetNode) throws Exception;
-
- /**
- * Calls method on target node only. The call will return immediately and
- * will not wait for the node to answer. Thus no answer is available.
- *
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param targetNode is the target of the call
- * @param unordered <code>true</code> if the HAPartition isn't required to ensure
- * that this RPC is invoked on all nodes in a consistent order with respect
- * to other RPCs originated by the same node
- */
- public void callAsyncMethodOnNode(String serviceName, String methodName,
- Object[] args, Class<?>[] types, ClusterNode targetNode, boolean unordered) throws Exception;
-
- /**
- * Calls method on Cluster coordinator node only. The cluster coordinator
- * node is the first node in the current cluster view. The call will return immediately and
- * will not wait for the node to answer. Thus no answer is available. This convenience method is equivalent to
- * {@link #callAsyncMethodOnCoordinatorNode(String, String, Object[], Class[], boolean, boolean)
- * callMethodOnCoordinatorNode(serviceName, methodName, args, types, excludeSelf, false)}}.
- *
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param excludeSelf <code>true</code> if the RPC should not be made on the
- * current node even if the current node is the coordinator
- */
- public void callAsyncMethodOnCoordinatorNode(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. The call will return immediately and
- * will not wait for the node to answer. Thus no answer is available.
- *
- * @param serviceName name of the target service name on which calls are invoked
- * @param methodName name of the Java method to be called on remote services
- * @param args array of Java Object representing the set of parameters to be
- * given to the remote method
- * @param types types of the parameters
- * @param excludeSelf <code>true</code> if the RPC should not be made on the
- * current node even if the current node is the coordinator
- * @param unordered <code>true</code> if the HAPartition isn't required to ensure
- * that this RPC is invoked on all nodes in a consistent order with respect
- * to other RPCs originated by the same node
- * @return the value returned by the target method
- */
- public void callAsyncMethodOnCoordinatorNode(String serviceName, String methodName,
- Object[] args, Class<?>[] types, boolean excludeSelf, boolean unordered) throws Exception;
-
+ @Deprecated
+ @Override
+ public ArrayList<?> callMethodOnCluster(String serviceName, String methodName,
+ Object[] args, Class<?>[] types, boolean excludeSelf, ResponseFilter filter) throws InterruptedException;
// *************************
// *************************
// State transfer management
@@ -433,15 +149,13 @@
* State management is highly important for clustered services. Consequently, services that wish to manage their state
* need to subscribe to state transfer events. When a service is started on a cluster node, state is pushed from another node to the
* new node. When another node starts, the node may be asked to provide its state to initialise the newly started node.
+ *
+ * @deprecated Use the {@link GroupStateTransferService} API
*/
- public interface HAPartitionStateTransfer
+ @Deprecated
+ public interface HAPartitionStateTransfer extends StateTransferProvider
{
/**
- * Called when a new node needs to be initialized. This is called on any existing node to determine a current state for this service.
- * @return A serializable representation of the state
- */
- public Serializable getCurrentState ();
- /**
* This callback method is called when a new service starts on a new node; the state that it should hold is transfered to it through this callback.
* @param newState The serialized representation of the state of the new service.
*/
@@ -452,14 +166,20 @@
* Register a service that will participate in state transfer protocol and receive callbacks
* @param serviceName Name of the service that subscribes for state transfer events. This name must be identical for all identical services in the cluster.
* @param subscriber Object implementing {@link HAPartitionStateTransfer} and providing or receiving state transfer callbacks
+ *
+ * @deprecated Use the {@link GroupStateTransferService} API
*/
+ @Deprecated
public void subscribeToStateTransferEvents (String serviceName, HAPartition.HAPartitionStateTransfer subscriber);
/**
* Unregister a service from state transfer callbacks.
* @param serviceName Name of the service that participates in the state transfer protocol
* @param subscriber Service implementing the state transfer callback methods
+ *
+ * @deprecated Use the {@link GroupStateTransferService} API
*/
+ @Deprecated
public void unsubscribeFromStateTransferEvents (String serviceName, HAPartition.HAPartitionStateTransfer subscriber);
// *************************
@@ -471,7 +191,10 @@
/**
* Listener for notifications issued when a new node joins the cluster or an
* existing node leaves the cluster (or simply dies).
- */
+ *
+ * @deprecated Use {@link GroupMembershipListener}
+ */
+ @Deprecated
public interface HAMembershipListener
{
/** Called when a partition topology change occurs. This callback may be
@@ -492,7 +215,10 @@
* notifications to be issued by a thread separate from the thread that
* carries messages up from the network. The ordering of view changes is
* preserved, but listeners are free to execute cluster calls.
+ *
+ * @deprecated Use {@link GroupMembershipListener}
*/
+ @Deprecated
public interface AsynchHAMembershipListener extends HAMembershipListener
{
// Nothing new
@@ -503,7 +229,10 @@
* network-partition merge occurs. A merge occurs when two or more nodes that
* were unaware of each other for some reason (e.g. a crashed switch) detect
* each other and form a single group.
+ *
+ * @deprecated Use {@link GroupMembershipListener}
*/
+ @Deprecated
public interface HAMembershipExtendedListener extends HAPartition.HAMembershipListener
{
/**
@@ -529,7 +258,10 @@
* be performed in a thread separate from the thread that carries messages
* up from the network. The ordering of view changes is preserved, but
* listeners are free to execute cluster calls.
+ *
+ * @deprecated Use {@link GroupMembershipListener}
*/
+ @Deprecated
public interface AsynchHAMembershipExtendedListener extends HAMembershipExtendedListener
{
// Nothing new
@@ -538,13 +270,19 @@
/**
* Subscribes to receive {@link HAMembershipListener} events.
* @param listener The membership listener object
+ *
+ * @deprecated Use {@link #registerGroupMembershipListener(GroupMembershipListener)}
*/
+ @Deprecated
public void registerMembershipListener(HAMembershipListener listener);
/**
* Unsubscribes from receiving {@link HAMembershipListener} events.
* @param listener The listener wishing to unsubscribe
- */
+ *
+ * @deprecated Use {@link #unregisterGroupMembershipListener(GroupMembershipListener)}
+ */
+ @Deprecated
public void unregisterMembershipListener(HAMembershipListener listener);
/**
@@ -558,47 +296,16 @@
* synchronously of membership changes; <code>false</code> if
* those listeners will be notified asynchronously. Default
* is <code>false</code>.
- */
- public boolean getAllowSynchronousMembershipNotifications();
-
- /**
- * Sets whether this partition will synchronously notify any
- * HAMembershipListeners of membership changes using the calling thread
- * from the underlying <code>ClusterPartition</code>.
*
- * @param allowSync <code>true</code> if registered listeners that don't
- * implement <code>AsynchHAMembershipExtendedListener</code> or
- * <code>AsynchHAMembershipListener</code> should be notified
- * synchronously of membership changes; <code>false</code> if
- * those listeners can be notified asynchronously. Default
- * is <code>false</code>.
- */
- public void setAllowSynchronousMembershipNotifications(boolean allowSync);
-
- /**
- * 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.
- * @return The identifier of the current view
+ * @deprecated Use {@link GroupMembershipListener} API; synchronous notifications
+ * will eventually not be allowed
*/
- public long getCurrentViewId();
+ @Deprecated
+ public boolean getAllowSynchronousMembershipNotifications();
/**
* Return the list of member nodes that built the current view i.e., the current partition.
* @return An array of Strings containing the node names
*/
public Vector<String> getCurrentView ();
-
- /**
- * Return the member nodes that built the current view i.e., the current partition.
- * @return 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.
- */
- public ClusterNode[] getClusterNodes ();
-
- /**
- * Return member node for the current cluster node.
- * @return ClusterNode containing the current node name
- */
- public ClusterNode getClusterNode ();
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list