[jboss-cvs] JBossAS SVN: r69400 - in projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha: framework/interfaces and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jan 28 16:32:48 EST 2008
Author: bstansberry at jboss.com
Date: 2008-01-28 16:32:48 -0500 (Mon, 28 Jan 2008)
New Revision: 69400
Modified:
projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/client/loadbalance/RoundRobin.java
projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/ClusteringTargetsRepository.java
projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/FamilyClusterInfo.java
projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/GenericClusteringException.java
Log:
Javadoc
Modified: projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/client/loadbalance/RoundRobin.java
===================================================================
--- projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/client/loadbalance/RoundRobin.java 2008-01-28 21:26:56 UTC (rev 69399)
+++ projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/client/loadbalance/RoundRobin.java 2008-01-28 21:32:48 UTC (rev 69400)
@@ -38,6 +38,11 @@
* call, it will invoke on target 2; the third call will go to
* target 3 no matter which proxy makes it, and so on.
* </p>
+ * <p>
+ * The first target in the round-robin is chosen randomly, ensuring that
+ * proper load balancing occurs when many clients in different VM's download
+ * the proxy.
+ * </p>
*
* @see org.jboss.ha.client.loadbalance.LoadBalancePolicy
* @see org.jboss.ha.framework.interfaces.FamilyClusterInfo#getCursor()
Modified: projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/ClusteringTargetsRepository.java
===================================================================
--- projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/ClusteringTargetsRepository.java 2008-01-28 21:26:56 UTC (rev 69399)
+++ projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/ClusteringTargetsRepository.java 2008-01-28 21:32:48 UTC (rev 69400)
@@ -26,8 +26,8 @@
/**
* JVM singleton that associates a list of targets (+ other info)
- * contained in a FamilyClusterInfo to a proxy family. For example
- * All remote proxies for a given EJB in a given cluster are part of the
+ * contained in a {@link FamilyClusterInfo} to a proxy family. For example,
+ * all remote proxies for a given EJB in a given cluster are part of the
* same proxy family. Note that home and remote for a same EJB form *2*
* proxy families.
*
Modified: projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/FamilyClusterInfo.java
===================================================================
--- projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/FamilyClusterInfo.java 2008-01-28 21:26:56 UTC (rev 69399)
+++ projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/FamilyClusterInfo.java 2008-01-28 21:32:48 UTC (rev 69400)
@@ -23,6 +23,9 @@
import java.util.List;
+import org.jboss.ha.client.loadbalance.FirstAvailableIdenticalAllProxies;
+import org.jboss.ha.client.loadbalance.RoundRobin;
+
/**
* Maintain information for a given proxy family. Proxies can statically reference
* objects implementing this interface: only the content will change as the
@@ -30,7 +33,8 @@
* Proxies or LoadBalancing policy implementations can use the cursor and object
* attribute to store arbitrary data that is then shared accross all proxies belonging
* to the same family.
- * Initial access to this object is done through the ClusteringTargetsRepository singleton.
+ * Initial access to this object is done through the
+ * {@link ClusteringTargetsRepository} singleton.
*
* @see org.jboss.ha.framework.interfaces.FamilyClusterInfoImpl
* @see org.jboss.ha.framework.interfaces.ClusteringTargetsRepository
@@ -57,6 +61,14 @@
* when executing this method (see JBAS-2071).
*/
public List getTargets ();
+
+ /**
+ * Gets a shorthand identifier for the current cluster topology for
+ * the clustered service represented by this object. The identifer is
+ * generated on the server side; clients can pass this view id to the
+ * server side to check whether their current view of the service
+ * topology matches what the server sees.
+ */
public long getCurrentViewId ();
/**
@@ -78,6 +90,16 @@
*/
public List updateClusterInfo (List targets, long viewId);
+ /**
+ * Gets whether this object believes its current
+ * {@link #getTargets() target list} matches what the server-side
+ * used to generate the {@link #getCurrentViewId() view id}.
+ * <p>
+ * Generally, a call to {@link #removeDeadTarget(Object)} would cause
+ * this method to return <code>false</code> until a subsequent call
+ * to {@link #updateClusterInfo(List, long)} is made.
+ * </p>
+ */
public boolean currentMembershipInSyncWithViewId();
/**
@@ -88,15 +110,58 @@
*/
public void resetView ();
- // arbitrary usage by the LoadBalancePolicy implementation
- // We could have used an HashMap but the lookup would have taken
- // much more time and we probably don't need as much flexibility
- // (+ it is slow for a simple int)
- //
+ /**
+ * Gets a cursor indicating a position in the current
+ * {@link #getTargets() list of targets}. Useful for round-robin load
+ * balancing strategies that wish to coordinate between instances.
+ * <p>
+ * It is not guaranteed that the returned value will be less than the size
+ * of the target list; callers need to verify that themselves.
+ * </p>
+ *
+ * @see #UNINITIALIZED_CURSOR
+ * @see RoundRobin
+ */
public int getCursor();
+
+ /**
+ * Sets a cursor indicating a position in the current
+ * {@link #getTargets() list of targets}. Useful for round-robin load
+ * balancing strategies that wish to coordinate between instances.
+ *
+ * @param
+ */
public int setCursor (int cursor);
- public Object getObject ();
- public Object setObject (Object whatever);
+ /**
+ * Gets an object that may be one of the members of the current
+ * {@link #getTargets() list of targets}. Useful for "sticky" load
+ * balancing strategies that wish to coordinate between instances.
+ * <p>
+ * It is not guaranteed that the returned object will be a current member of
+ * the target list; callers need to verify that themselves.
+ * </p>
+ *
+ * @return an object that *may* be an element in the target list, or
+ * may be <code>null</code>
+ *
+ * @see FirstAvailableIdenticalAllProxies
+ */
+ public Object getObject();
+
+ /**
+ * Sets the member of the current {@link #getTargets() list of targets}
+ * that "sticky" load balancing strategies that wish to coordinate between
+ * instances should use.
+ *
+ * @param whatever *should* be a member of the current list of targets, or
+ * <code>null</code>. However, this requirement is not
+ * enforced.
+ */
+ public Object setObject(Object whatever);
+
+ /**
+ * Initial value returned by {@link #getCursor()}.
+ */
public final static int UNINITIALIZED_CURSOR = 999999999;
}
Modified: projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/GenericClusteringException.java
===================================================================
--- projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/GenericClusteringException.java 2008-01-28 21:26:56 UTC (rev 69399)
+++ projects/cluster/ha-client/trunk/src/main/java/org/jboss/ha/framework/interfaces/GenericClusteringException.java 2008-01-28 21:32:48 UTC (rev 69400)
@@ -26,7 +26,7 @@
/**
* Generic clustering exception that can be used to replace other exceptions
* that occur on the server. Thus, only this class is needed on the client side
- * and some specific server side exceptions class are not needed on the client side
+ * and some specific server side exceptions classes are not needed on the client side
* (such as JMX exceptions for example).
* Furthermore, it has support for "COMPLETED" status flag a la IIOP.
* <p>
More information about the jboss-cvs-commits
mailing list