User: slaboure
Date: 01/11/26 07:39:32
Modified: src/main/org/jboss/ha/framework/interfaces
FirstAvailable.java LoadBalancePolicy.java
RoundRobin.java
Log:
ArrayList => List
Added javadoc comments.
Reorganized code to JBoss coding conventions.
Revision Changes Path
1.2 +41 -11
jbossmx/src/main/org/jboss/ha/framework/interfaces/FirstAvailable.java
Index: FirstAvailable.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/interfaces/FirstAvailable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FirstAvailable.java 2001/10/16 22:16:48 1.1
+++ FirstAvailable.java 2001/11/26 15:39:32 1.2
@@ -1,28 +1,58 @@
-package org.jboss.ha.framework.interfaces;
-
-
-import java.util.ArrayList;
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ha.framework.interfaces;
-/**
+/**
+ * LoadBalancingPolicy implementation that always favor the first available target
i.e.
+ * no load balancing occurs. This does not mean that fail-over will not occur if the
+ * first member in the list dies. In this case, fail-over will occur, and a new
target
+ * will become the first member and invocation will continously be invoked on the
same
+ * new target until its death.
*
- * @author [EMAIL PROTECTED]
- * @author [EMAIL PROTECTED]
- * @version $Revision: 1.1 $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a>.
+ * @version $Revision: 1.2 $
+ * @see LoadBalancePolicy
*
* <p><b>Revisions:</b><br>
*/
+
public class FirstAvailable implements LoadBalancePolicy
{
- protected transient int cursorRemote = 0;
-
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
public void init (HARMIClient father)
{
// do not use the HARMIClient in this policy
}
- public Object chooseTarget(ArrayList targets)
+ public Object chooseTarget (java.util.List targets)
{
return targets.get(0);
}
+
+ // Z implementation ----------------------------------------------
+
+ // Y overrides ---------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
}
1.3 +26 -10
jbossmx/src/main/org/jboss/ha/framework/interfaces/LoadBalancePolicy.java
Index: LoadBalancePolicy.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/interfaces/LoadBalancePolicy.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LoadBalancePolicy.java 2001/10/10 20:02:05 1.2
+++ LoadBalancePolicy.java 2001/11/26 15:39:32 1.3
@@ -1,21 +1,37 @@
-package org.jboss.ha.framework.interfaces;
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
-import java.util.ArrayList;
+package org.jboss.ha.framework.interfaces;
-/**
+/**
+ * Base interface for load-balancing policies. It is possible to implement many
different
+ * load-balancing policies by implementing this simple interface and using it in the
+ * different clustered services (home interface of SLSB for example)
*
- * @author [EMAIL PROTECTED]
- * @author [EMAIL PROTECTED]
- * @version $Revision: 1.2 $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a>.
+ * @version $Revision: 1.3 $
*
* <p><b>Revisions:</b><br>
*/
+
public interface LoadBalancePolicy extends java.io.Serializable
{
- // Init method called by the HARMIProxy so that the implementation
- // can use HARMIClient data to take its decision
- //
+ /**
+ * Initialize the policy with a reference to its parent stub. the load-balancing
policy
+ * implementation can use HARMIClient data to take its decision
+ * @param father The stub that owns the policy
+ */
public void init (HARMIClient father);
- public Object chooseTarget (ArrayList targets);
+ /**
+ * Called when the stub wishes to know on which node the next invocation must be
performed.
+ * @param targets A list of potential target nodes
+ * @return The selected target for the next invocation
+ */
+ public Object chooseTarget (java.util.List targets);
}
1.3 +43 -9
jbossmx/src/main/org/jboss/ha/framework/interfaces/RoundRobin.java
Index: RoundRobin.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/interfaces/RoundRobin.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RoundRobin.java 2001/10/10 20:02:05 1.2
+++ RoundRobin.java 2001/11/26 15:39:32 1.3
@@ -1,29 +1,63 @@
-package org.jboss.ha.framework.interfaces;
-
-
-import java.util.ArrayList;
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ha.framework.interfaces;
-/**
+/**
+ * LoadBalancingPolicy implementation that always favor the next available target
i.e.
+ * load balancing always occurs.
*
- * @author [EMAIL PROTECTED]
- * @author [EMAIL PROTECTED]
- * @version $Revision: 1.2 $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a>.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>.
+ * @version $Revision: 1.3 $
+ * @see LoadBalancePolicy
*
* <p><b>Revisions:</b><br>
*/
+
+
public class RoundRobin implements LoadBalancePolicy
{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ /**
+ * Index in the list of possible targets on which the previous call has been
+ * performed.
+ */
protected transient int cursorRemote = 0;
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
public void init (HARMIClient father)
{
// do not use the HARMIClient in this policy
}
- public Object chooseTarget(ArrayList targets)
+ public Object chooseTarget(java.util.List targets)
{
cursorRemote = ( (cursorRemote + 1) % targets.size() );
return targets.get(cursorRemote);
}
+
+ // Z implementation ----------------------------------------------
+
+ // Y overrides ---------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development