[jboss-cvs] JBossAS SVN: r104398 - 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
Mon May 3 16:05:13 EDT 2010
Author: bstansberry at jboss.com
Date: 2010-05-03 16:05:12 -0400 (Mon, 03 May 2010)
New Revision: 104398
Added:
projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupCommunicationService.java
projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupMembershipListener.java
projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupMembershipNotifier.java
projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupRpcDispatcher.java
projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupStateTransferService.java
projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferProvider.java
Log:
[JBCLUSTER-139] Create HAPartition super-interfaces
Added: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupCommunicationService.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupCommunicationService.java (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupCommunicationService.java 2010-05-03 20:05:12 UTC (rev 104398)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.framework.interfaces;
+
+
+/**
+ * Abstraction of a server that provides group communication services to a set
+ * of nodes that share a common group communication infrastructure. This is a
+ * base interface that provides common methods expected to be used by
+ * subinterfaces that provide more useful services.
+ *
+ * @author Brian Stansberry
+ *
+ * @version $Revision: 104233 $
+ */
+public interface GroupCommunicationService
+{
+ /**
+ * Gets the object that represents this node in the current group.
+ *
+ * @return ClusterNode containing the current node name
+ */
+ ClusterNode getClusterNode();
+
+ /**
+ * Return the name of this node in the current group. The name will be the
+ * String returned by <code>getClusterNode().getName()</code>.
+ *
+ * @return The node name
+ *
+ * @see #getClusterNode()
+ */
+ String getNodeName();
+
+ /**
+ * The name of the group with which communication occurs.
+ *
+ * @return Name of the current group
+ */
+ String getGroupName();
+
+ /**
+ * Gets the member nodes that comprise the current group membership.
+ * @return An array of ClusterNode listing the current members of the group.
+ * This array will be in the same order in all nodes in the cluster that
+ * have received the current membership view.
+ */
+ ClusterNode[] getClusterNodes();
+
+ /**
+ * Identifier for the current group topology. Each time the group 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
+ */
+ public long getCurrentViewId();
+
+ /**
+ * Gets whether this GroupCommunicationService is logically consistent with
+ * another service; e.g. is using common group communication infrastructure.
+ *
+ * @param other the other GroupCommunicationService. Cannot be <code>null</code>.
+ *
+ * @return <code>true</code> if an application can use this service and
+ * <code>other</code> together to interact with the same set of
+ * nodes.
+ */
+ boolean isConsistentWith(GroupCommunicationService other);
+
+}
\ No newline at end of file
Added: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupMembershipListener.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupMembershipListener.java (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupMembershipListener.java 2010-05-03 20:05:12 UTC (rev 104398)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ha.framework.interfaces;
+
+import java.util.List;
+
+/**
+ * Listener for notifications issued when a new node joins the cluster or an
+ * existing node leaves the cluster (or simply dies).
+ *
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public interface GroupMembershipListener
+{
+ /**
+ * Called when a partition topology change occurs. This callback will not be
+ * made using the thread that carries messages up from the network.
+ *
+ * @param deadMembers A list of nodes that have died since the previous view
+ * @param newMembers A list of nodes that have joined the partition since the previous view
+ * @param allMembers A list of nodes that built the current view
+ */
+ void membershipChanged(List<ClusterNode> deadMembers, List<ClusterNode> newMembers, List<ClusterNode> allMembers);
+
+ /**
+ * Specialized notification issued instead of
+ * {@link #membershipChanged(List, List, List) the standard one}
+ * when a network-partition merge occurs. This callback will not be
+ * made using the thread that carries messages up from the network.
+ *
+ * @param deadMembers A list of nodes that have died since the previous view
+ * @param newMembers A list of nodes that have joined the partition since the previous view
+ * @param allMembers A list of nodes that built the current view
+ * @param originatingGroups A list of nodes that were previously partioned and that are now merged
+ */
+ public void membershipChangedDuringMerge(List<ClusterNode> deadMembers, List<ClusterNode> newMembers,
+ List<ClusterNode> allMembers, List<List<ClusterNode>> originatingGroups);
+}
Added: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupMembershipNotifier.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupMembershipNotifier.java (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupMembershipNotifier.java 2010-05-03 20:05:12 UTC (rev 104398)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ha.framework.interfaces;
+
+
+/**
+ * Allows an application to register for notifications when the group
+ * membership changes.
+ *
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public interface GroupMembershipNotifier extends GroupCommunicationService
+{
+
+ /**
+ * Subscribes to receive {@link GroupMembershipListener} events.
+ * @param listener The membership listener object
+ */
+ void registerGroupMembershipListener(GroupMembershipListener listener);
+
+ /**
+ * Unsubscribes from receiving {@link GroupMembershipListener} events.
+ * @param listener The listener wishing to unsubscribe
+ */
+ void unregisterGroupMembershipListener(GroupMembershipListener listener);
+
+}
Added: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupRpcDispatcher.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupRpcDispatcher.java (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupRpcDispatcher.java 2010-05-03 20:05:12 UTC (rev 104398)
@@ -0,0 +1,370 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.framework.interfaces;
+
+import java.util.List;
+
+/**
+ * Provide Remote Procedure Call services to a set of nodes that share
+ * a common group communication infrastructure.
+ *
+ * @author Brian Stansberry
+ *
+ * @version $Revision: 104233 $
+ */
+public interface GroupRpcDispatcher extends GroupCommunicationService
+{
+ /**
+ * 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);
+
+
+ /**
+ * Invoke an RPC call on all nodes of the partition/cluster and return their
+ * response values as a list. This convenience method is equivalent to
+ * {@link #callMethodOnCluster(String, String, Object[], Class[], Class, boolean, ResponseFilter, long, boolean)
+ * callAsynchMethodOnCluster(serviceName, methodName, args, types, Object.class, excludeSelf, null, 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>false</code> if the RPC must also be made on the current
+ * node of the partition, <code>true</code> if only on remote nodes
+ *
+ * @return an array of responses from nodes that invoked the RPC
+ */
+ public List<?> callMethodOnCluster(String serviceName, String methodName,
+ Object[] args, Class<?>[] types, boolean excludeSelf) throws InterruptedException;
+
+ /**
+ * Invoke a synchronous RPC call on all nodes of the partition/cluster and return their
+ * response values as a list. This convenience method is equivalent to
+ * {@link #callMethodOnCluster(String, String, Object[], Class[], boolean, ResponseFilter, boolean)
+ * callAsynchMethodOnCluster(serviceName, methodName, args, types, Object.class, excludeSelf, filter, 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>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 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
+ */
+ 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;
+}
\ No newline at end of file
Added: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupStateTransferService.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupStateTransferService.java (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/GroupStateTransferService.java 2010-05-03 20:05:12 UTC (rev 104398)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ha.framework.interfaces;
+
+import java.io.Serializable;
+import java.util.concurrent.Future;
+
+/**
+ * A GroupCommunicationService that is able to help applications provide current
+ * service state to newly joined group members.
+ * <p>
+ * All nodes that expect to be able to {@link #getServiceState(String) receive state}
+ * must also {@link #registerStateTransferProvider(String, StateTransferProvider) register to provide state}.
+ *
+ * @see StateTransferProvider
+ *
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public interface GroupStateTransferService extends GroupCommunicationService
+{
+ /**
+ * Gets the current service state from an existing member of the group.
+ * Intended to be called by newly joining members of the group.
+ * <p>
+ * Equivalent to <code>getServiceState(serviceName, null)</code>.
+ * </p>
+ *
+ * @param serviceName the name of the service
+ *
+ * @return <code>Future</code> whose {@link Future#get() get()} method will
+ * return the service state when it becomes available.
+ */
+ Future<Serializable> getServiceState(String serviceName);
+
+ /**
+ * Gets the current service state from an existing member of the group, using
+ * the given classloader to deserialize it.
+ * Intended to be called by newly joining members of the group.
+ *
+ * @param serviceName the name of the service
+ * @param classloader the ClassLoader to use to deserialize the state when
+ * it becomes available. May be <code>null</code> in which
+ * case the GroupStateTransferService implementation class'
+ * classloader will be used.
+ *
+ * @return <code>Future</code> whose {@link Future#get() get()} method will
+ * return the service state when it becomes available.
+ */
+ Future<Serializable> getServiceState(String serviceName, ClassLoader classloader);
+
+ /**
+ * Registers the object that can provide state for the service when
+ * newly joining group members request it.
+ *
+ * @param serviceName the name of the service
+ * @param provider the state provider
+ */
+ void registerStateTransferProvider(String serviceName, StateTransferProvider provider);
+
+ /**
+ * Unregisters the object that can provide state for the service.
+ *
+ * @param serviceName the name of the service
+ */
+ void unregisterStateTransferProvider(String serviceName);
+}
Added: projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferProvider.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferProvider.java (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/main/java/org/jboss/ha/framework/interfaces/StateTransferProvider.java 2010-05-03 20:05:12 UTC (rev 104398)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ha.framework.interfaces;
+
+import java.io.Serializable;
+
+
+/**
+ * Interface implemented by {@link GroupCommunicationService} users that
+ * wish can provide application state to newly joining group members.
+ *
+ * @author Brian Stansberry
+ *
+ * @version $Revision$
+ */
+public interface StateTransferProvider
+{
+ /**
+ * Called on an existing member of the group when a new node needs to be
+ * initialized with the current application state.
+ *
+ * @return A serializable representation of the state
+ */
+ Serializable getCurrentState();
+}
More information about the jboss-cvs-commits
mailing list