User: slaboure
Date: 01/11/26 07:39:53
Modified: src/main/org/jboss/ha/framework/interfaces
SubPartitionInfo.java SubPartitionsInfo.java
Log:
Added javadoc comments.
Reorganized code to JBoss coding conventions.
Revision Changes Path
1.2 +68 -41
jbossmx/src/main/org/jboss/ha/framework/interfaces/SubPartitionInfo.java
Index: SubPartitionInfo.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/interfaces/SubPartitionInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SubPartitionInfo.java 2001/11/09 22:41:22 1.1
+++ SubPartitionInfo.java 2001/11/26 15:39:53 1.2
@@ -9,38 +9,50 @@
import java.util.ArrayList;
import java.util.HashSet;
-import java.io.Serializable;
/**
* Holder class that knows about a particular HA(sub)Partition i.e. member nodes,
* partition name and some utility functions.
*
- * @see HASessionState, HASessionStateImpl
+ * @see org.jboss.ha.hasessionstate.interfaces.HASessionState
+ * @see org.jboss.ha.hasessionstate.server.HASessionStateImpl
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*
* <p><b>Revisions:</b>
*/
-public class SubPartitionInfo implements Serializable, Comparable, Cloneable
+public class SubPartitionInfo
+ implements Comparable, Cloneable, java.io.Serializable
{
- // Name of the current sub-partition (will be used to create a JavaGroups group)
- //
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ /**
+ * Name of the current sub-partition (will be used to create a JavaGroups group)
+ */
public String subPartitionName = null;
- // When sub-partitions are merged, some names will disappear (eg. Merge G1 and
G2 in G1)
- // this structure remembers the removed named so that HAPartition can know which
new group
- // they should join
- //
+ /**
+ * When sub-partitions are merged, some names will disappear (eg. Merge G1 and
G2 in G1)
+ * this structure remembers the removed named so that HAPartition can know which
new group
+ * they should join
+ */
public HashSet subPartitionMergedNames = new HashSet ();
- // List of nodes part of this sub-partition
- //
+ /**
+ * List of nodes part of this sub-partition
+ */
public ArrayList memberNodeNames = new ArrayList ();
private transient boolean newGroup = false;
-
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
public SubPartitionInfo () {}
public SubPartitionInfo (String partitionName, String[] members)
@@ -52,39 +64,13 @@
this.memberNodeNames.add (members[i]);
}
+ // Public --------------------------------------------------------
+
public void setIsNewGroup ()
{
this.newGroup = true;
}
- /**
- * "Note: this class has a natural ordering that is
- * inconsistent with equals."
- */
- public int compareTo (Object o)
- {
- int mySize = memberNodeNames.size ();
- int itsSize = ((SubPartitionInfo)o).memberNodeNames.size ();
-
- if (mySize==itsSize)
- return 0;
- else if (mySize > itsSize)
- return 1;
- else
- return -1;
-
- }
-
- public Object clone ()
- {
- SubPartitionInfo clonedObject = new SubPartitionInfo ();
- clonedObject.subPartitionName = this.subPartitionName;
- clonedObject.memberNodeNames = (ArrayList)this.memberNodeNames.clone ();
- clonedObject.subPartitionMergedNames =
(HashSet)this.subPartitionMergedNames.clone ();
-
- return clonedObject;
- }
-
public void merge (SubPartitionInfo merged)
{
this.memberNodeNames.addAll (merged.memberNodeNames);
@@ -115,5 +101,46 @@
{
return memberNodeNames.contains (node);
}
+
+ // Comparable implementation ----------------------------------------------
+
+ /**
+ * "Note: this class has a natural ordering that is
+ * inconsistent with equals."
+ */
+ public int compareTo (Object o)
+ {
+ int mySize = memberNodeNames.size ();
+ int itsSize = ((SubPartitionInfo)o).memberNodeNames.size ();
+
+ if (mySize==itsSize)
+ return 0;
+ else if (mySize > itsSize)
+ return 1;
+ else
+ return -1;
+
+ }
+ // Cloneable implementation ----------------------------------------------
+
+ public Object clone ()
+ {
+ SubPartitionInfo clonedObject = new SubPartitionInfo ();
+ clonedObject.subPartitionName = this.subPartitionName;
+ clonedObject.memberNodeNames = (ArrayList)this.memberNodeNames.clone ();
+ clonedObject.subPartitionMergedNames =
(HashSet)this.subPartitionMergedNames.clone ();
+
+ return clonedObject;
+ }
+
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
}
1.2 +35 -3
jbossmx/src/main/org/jboss/ha/framework/interfaces/SubPartitionsInfo.java
Index: SubPartitionsInfo.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/interfaces/SubPartitionsInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SubPartitionsInfo.java 2001/11/09 22:41:22 1.1
+++ SubPartitionsInfo.java 2001/11/26 15:39:53 1.2
@@ -14,25 +14,44 @@
* building the overall cluster. Exchanged between HASessionState
* instances to share the same knowledge.
*
- * @see SubPartitionInfo, HASessionState, HASessionStateImpl
+ * @see SubPartitionInfo
+ * @see org.jboss.ha.hasessionstate.interfaces.HASessionState
+ * @see org.jboss.ha.hasessionstate.server.HASessionStateImpl
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*
* <p><b>Revisions:</b>
*/
public class SubPartitionsInfo implements Serializable, Cloneable {
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
public SubPartitionInfo[] partitions = null;
protected long groupId = 0;
-
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
public SubPartitionsInfo () {}
+ // Public --------------------------------------------------------
+
+ /**
+ * return the next distinct id for a new group
+ */
public long getNextGroupId ()
{
return groupId++;
}
+ /**
+ * Returns the {@link SubPartitionInfo} instance in this group that has the
given name.
+ */
public SubPartitionInfo getSubPartitionWithName (String name)
{
if (partitions != null)
@@ -45,6 +64,8 @@
return null;
}
+ // Cloneable implementation ----------------------------------------------
+
public Object clone ()
{
SubPartitionsInfo theClone = new SubPartitionsInfo ();
@@ -62,6 +83,8 @@
}
+ // Object overrides ---------------------------------------------------
+
public String toString ()
{
String result = null;
@@ -78,4 +101,13 @@
return result;
}
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development