User: patriot1burke
Date: 01/11/19 15:13:49
Modified: src/main/org/jboss/ha/framework/server
ClusterPartitionMBean.java ClusterPartition.java
Log:
implemented 2-phase initialization under new mbean code (removal of init())
Revision Changes Path
1.3 +34 -30
jbossmx/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java
Index: ClusterPartitionMBean.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ClusterPartitionMBean.java 2001/11/11 19:04:25 1.2
+++ ClusterPartitionMBean.java 2001/11/19 23:13:49 1.3
@@ -1,30 +1,34 @@
-package org.jboss.ha.framework.server;
-
-import org.jboss.ha.framework.interfaces.HAPartition;
-
-public interface ClusterPartitionMBean
- extends org.jboss.system.ServiceMBean
-{
- // Constants -----------------------------------------------------
- public static final String OBJECT_NAME = ":service=HANaming";
-
- public String getPartitionName();
- public void setPartitionName(String newName);
-
- public String getPartitionProperties(); // i.e. JavaGroups properties
- public void setPartitionProperties(String newProps);
-
- public boolean getDeadlockDetection();
- public void setDeadlockDetection(boolean doit);
-
- // Access to the underlying HAPartition without going through JNDI
- //
- public HAPartition getHAPartition ();
-}
-
-
-
-
-
-
-
+package org.jboss.ha.framework.server;
+
+import java.util.Collection;
+import org.jboss.ha.framework.interfaces.HAPartition;
+
+public interface ClusterPartitionMBean
+ extends org.jboss.system.ServiceMBean
+{
+ // Constants -----------------------------------------------------
+ static final String OBJECT_NAME = ":service=ClusterPartition";
+
+ String getPartitionName();
+ void setPartitionName(String newName);
+
+ String getPartitionProperties(); // i.e. JavaGroups properties
+ void setPartitionProperties(String newProps);
+
+ boolean getDeadlockDetection();
+ void setDeadlockDetection(boolean doit);
+
+ Collection getSynchronizedMBeans();
+ void setSynchronizedMBeans(Collection syncMBeans);
+
+ // Access to the underlying HAPartition without going through JNDI
+ //
+ HAPartition getHAPartition ();
+}
+
+
+
+
+
+
+
1.7 +63 -3
jbossmx/src/main/org/jboss/ha/framework/server/ClusterPartition.java
Index: ClusterPartition.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/server/ClusterPartition.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ClusterPartition.java 2001/11/12 19:59:17 1.6
+++ ClusterPartition.java 2001/11/19 23:13:49 1.7
@@ -10,6 +10,9 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.MalformedObjectNameException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
import org.jboss.metadata.ClusterConfigMetaData;
@@ -24,12 +27,13 @@
*
* @author [EMAIL PROTECTED]
* @author [EMAIL PROTECTED]
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*
* <p><b>Revisions:</b><br>
*/
public class ClusterPartition extends ServiceMBeanSupport implements
ClusterPartitionMBean
{
+ protected final Collection syncMBeans = new ArrayList();
protected String partitionName = ClusterConfigMetaData.DEFAULT_PARTITION;
protected String jgProps =
/*
@@ -58,7 +62,7 @@
"GMS:" +
"STATE_TRANSFER(trace=true):" +
"QUEUE";
- protected HAPartitionImpl partition;
+ protected HAPartitionImpl partition;
protected boolean deadlock_detection = false;
protected JChannel channel;
@@ -103,6 +107,23 @@
return new ObjectName(OBJECT_NAME);
}
+ public Collection getSynchronizedMBeans()
+ {
+ synchronized (syncMBeans)
+ {
+ return new ArrayList(syncMBeans);
+ }
+ }
+
+ public synchronized void setSynchronizedMBeans(Collection syncMBeans)
+ {
+ log.info("SynchronizedMBeans set to " + syncMBeans);
+ synchronized (this.syncMBeans)
+ {
+ this.syncMBeans.clear();
+ this.syncMBeans.addAll(syncMBeans);
+ }
+ }
public HAPartition getHAPartition ()
{
return this.partition;
@@ -124,6 +145,20 @@
partition.init();
log.info("...HAPartition initialized.");
+ synchronized (syncMBeans) //noone should be modifying this ever after it is
set originally
+ {
+ for (Iterator i = syncMBeans.iterator(); i.hasNext(); )
+ {
+ ObjectName mbean = (ObjectName)i.next();
+ log.info("registering " + mbean);
+ getServer().invoke(mbean,
+ "partitionInitializationPhase",
+ new Object[] {partition},
+ new String[]
{"org.jboss.ha.framework.interfaces.HAPartition"});
+ log.info("registered " + mbean);
+ } // end of for ()
+ }
+
log.info("Starting ClusterPartition: " + partitionName);
log.info(" Connecting to channel");
@@ -132,14 +167,39 @@
log.info(" Starting channel");
partition.start();
+ synchronized (syncMBeans) //noone should be modifying this ever after it is
set originally
+ {
+ for (Iterator i = syncMBeans.iterator(); i.hasNext(); )
+ {
+ ObjectName mbean = (ObjectName)i.next();
+ log.info("registering " + mbean);
+ getServer().invoke(mbean,
+ "startPartitionService",
+ new Object[] {partition},
+ new String[]
{"org.jboss.ha.framework.interfaces.HAPartition"});
+ log.info("registered " + mbean);
+ } // end of for ()
+ }
log.info("Started ClusterPartition: " + partitionName);
}
- public void stopService()
+ protected void stopService()
{
try
{
log.info("Stopping HAPartition: " + partitionName);
+ synchronized (syncMBeans) //noone should be modifying this ever after it
is set originally
+ {
+ for (Iterator i = syncMBeans.iterator(); i.hasNext(); )
+ {
+ ObjectName mbean = (ObjectName)i.next();
+ log.info("stopping " + mbean);
+ getServer().invoke(mbean,
+ "stopPartitionService",
+ null,
+ null);
+ } // end of for ()
+ }
partition.close();
log.info("Stopped HAPartition: " + partitionName);
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development