You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by az...@apache.org on 2008/05/17 08:00:23 UTC
svn commit: r657294 - in /webservices/axis2/trunk/java/modules:
clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
kernel/src/org/apache/axis2/clustering/ClusterManager.java
Author: azeez
Date: Fri May 16 23:00:23 2008
New Revision: 657294
URL: http://svn.apache.org/viewvc?rev=657294&view=rev
Log:
Added javadocs
Modified:
webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/ClusterManager.java
Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java?rev=657294&r1=657293&r2=657294&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java Fri May 16 23:00:23 2008
@@ -284,37 +284,39 @@
byte[] payload = "ping".getBytes();
localMember.setPayload(payload);
- try {
- for (org.apache.axis2.clustering.Member member : members) {
- StaticMember tribesMember = new StaticMember(member.getHostName(),
- member.getPort(),
- 0,
- payload);
- // Do not add the local member to the list of members
- if (!(Arrays.equals(localMember.getHost(), tribesMember.getHost()) &&
- localMember.getPort() == tribesMember.getPort())) {
- tribesMember.setDomain(domain);
- staticMembershipInterceptor.addStaticMember(tribesMember);
- try {
-
- // Before adding a static member, we will try to verify whether
- // we can connect to it
- InetAddress addr = InetAddress.getByName(member.getHostName());
- SocketAddress sockaddr = new InetSocketAddress(addr,
- member.getPort());
- new Socket().connect(sockaddr, 3000);
- membershipManager.memberAdded(tribesMember);
- log.info("Added static member " + TribesUtil.getHost(tribesMember));
- } catch (Exception e) {
- log.info("Could not connect to member " +
- TribesUtil.getHost(tribesMember));
- }
+ for (org.apache.axis2.clustering.Member member : members) {
+ StaticMember tribesMember;
+ try {
+ tribesMember = new StaticMember(member.getHostName(),
+ member.getPort(),
+ 0,
+ payload);
+ } catch (IOException e) {
+ String msg = "Could not add static member " +
+ member.getHostName() + ":" + member.getPort();
+ log.error(msg, e);
+ throw new ClusteringFault(msg, e);
+ }
+ // Do not add the local member to the list of members
+ if (!(Arrays.equals(localMember.getHost(), tribesMember.getHost()) &&
+ localMember.getPort() == tribesMember.getPort())) {
+ tribesMember.setDomain(domain);
+ staticMembershipInterceptor.addStaticMember(tribesMember);
+ try {
+
+ // Before adding a static member, we will try to verify whether
+ // we can connect to it
+ InetAddress addr = InetAddress.getByName(member.getHostName());
+ SocketAddress sockaddr = new InetSocketAddress(addr,
+ member.getPort());
+ new Socket().connect(sockaddr, 3000);
+ membershipManager.memberAdded(tribesMember);
+ log.info("Added static member " + TribesUtil.getHost(tribesMember));
+ } catch (Exception e) {
+ log.info("Could not connect to member " +
+ TribesUtil.getHost(tribesMember));
}
}
- } catch (IOException e) {
- String msg = "Could not add static members"; // TODO host and port
- log.error(msg, e);
- throw new ClusteringFault(msg, e);
}
} else if (membershipScheme.equals(ClusteringConstants.MembershipScheme.MULTICAST_BASED)) {
log.info("Using multicast based membership management scheme");
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/ClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/ClusterManager.java?rev=657294&r1=657293&r2=657294&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/ClusterManager.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/clustering/ClusterManager.java Fri May 16 23:00:23 2008
@@ -25,16 +25,42 @@
import org.apache.axis2.description.ParameterInclude;
/**
+ * <p>
* This is the main interface in the Axis2 clustering implementation.
* In order to plug-in a new clustering implementation, this interface has to be
* implemented.
+ * </p>
+ * <p>
+ * The initilization of a node in the cluster is handled here. It is also responsible for getting this
+ * node to join the cluster. This node should not process any Web services requests until it
+ * successfully joins the cluster. Generally, this node will also need to obtain the state
+ * information and/or configuration information from a neighboring node.
+ * This interface is also responsible for
+ * properly instantiating a {@link ContextManager} & {@link ConfigurationManager}. In the case of
+ * a static <a href="http://afkham.org/2008/05/group-membership-management-schemes.html">membership scheme</a>,
+ * this members are read from the axis2.xml file and added to the ClusterManager.
+ * </p>
+ * <p>
+ * In the axis2.xml, the instance of this interface is specified using the "cluster" class attribute.
+ * e.g.
+ * <code><b>
+ * <nobr><cluster class="org.apache.axis2.cluster.tribes.TribesClusterManager"></nobr>
+ * </b>
+ * </code>
+ * specifies that the TribesClusterManager class is the instance of this interface that
+ * needs to be used.
+ * </p>
+ * <p>
+ * There can also be several "parameter" elements, which are children of the "cluster" element
+ * in the axis2.xml file. Generally, these parameters will be specific to the ClusterManager implementation.
+ * </p>
*/
public interface ClusterManager extends ParameterInclude {
/**
- * Initialize the ClusteManager
+ * Initialize this node, and join the cluster
*
- * @throws ClusteringFault
+ * @throws ClusteringFault If an error occurs while initializing this node or joining the cluster
*/
void init() throws ClusteringFault;
@@ -49,36 +75,55 @@
ConfigurationManager getConfigurationManager();
/**
- * @param contextManager
+ * Set the ContextManager corresponding to this ClusterManager. This is an optional attribute.
+ * We can have a cluster with no context replication, in which case the contextManager will be
+ * null
+ *
+ * @param contextManager The ContextManager instance
*/
void setContextManager(ContextManager contextManager);
/**
+ * Set the ConfigurationManager corresponding to this ClusterManager. This is an optional attribute.
+ * We can have a cluster with no configuration management, in which case the configurationManager
+ * will be null
+ *
* @param configurationManager
*/
void setConfigurationManager(ConfigurationManager configurationManager);
/**
- * @throws ClusteringFault
+ * Disconnect this node from the cluster. This node will no longer receive membership change
+ * notifications, state change messages or configuration change messages. The node will be "
+ * "standing alone" once it is shutdown. However, it has to continue to process Web service
+ * requests.
+ *
+ * @throws ClusteringFault If an error occurs while leaving the cluster
*/
void shutdown() throws ClusteringFault;
/**
- * Set the configuration context
+ * Set the system's configuration context. This will be used by the clustering implementations
+ * to get information about the Axis2 environment and to correspond with the Axis2 environment
*
- * @param configurationContext
+ * @param configurationContext The configuration context
*/
void setConfigurationContext(ConfigurationContext configurationContext);
/**
- * Set the static members of the cluster. This is used only with static group membership.
+ * Set the static members of the cluster. This is used only with
+ * <a href="http://afkham.org/2008/05/group-membership-management-schemes.html">
+ * static group membership </a>
*
* @param members Members to be added
*/
void setMembers(Member[] members);
/**
- * Get the list of members in a static group
+ * Get the list of members in a
+ * <a href="http://afkham.org/2008/05/group-membership-management-schemes.html">
+ * static group
+ * </a>
*
* @return The members if static group membership is used. If any other membership scheme is used,
* the values returned may not be valid