[jboss-cvs] JBossAS SVN: r58574 - trunk/cluster/src/main/org/jboss/ha/framework/server
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Nov 18 06:34:11 EST 2006
Author: bstansberry at jboss.com
Date: 2006-11-18 06:34:10 -0500 (Sat, 18 Nov 2006)
New Revision: 58574
Modified:
trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
Log:
Make deployable via -beans.xml
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java 2006-11-18 11:33:01 UTC (rev 58573)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java 2006-11-18 11:34:10 UTC (rev 58574)
@@ -77,9 +77,6 @@
protected Logger log;
- protected MBeanServer mbeanserver;
- protected ObjectName jmxName;
-
protected String nodeName = null;
protected Latch partitionNameKnown = new Latch ();
@@ -93,21 +90,38 @@
// Constructors --------------------------------------------------
/**
- * This class manages replicated objects through the given partition
+ * Creates a DistributedReplicantManager that manages replicated objects
+ * through the given partition. Injects a back reference to this object
+ * into the partition.
*
- * @param partition {@link HAPartition} through which replicated objects will be exchanged
+ * @param partition {@link ClusterPartition} through which replicated
+ * objects will be exchanged
*/
- public DistributedReplicantManagerImpl(HAPartition partition, MBeanServer server)
+ public DistributedReplicantManagerImpl(ClusterPartition partition)
{
- this.partition = partition;
- this.mbeanserver = server;
- this.log = Logger.getLogger(DistributedReplicantManagerImpl.class.getName() + "." + partition.getPartitionName());
- this.trace = log.isTraceEnabled();
+ this(partition.getHAPartition());
+ // Set a back ref to ourself
+ partition.setDistributedReplicantManager(this);
}
+
+ /**
+ * Creates a DistributedReplicantManager that manages replicated objects
+ * through the given partition.
+ *
+ * @param partition {@link HAPartition} through which replicated objects
+ * will be exchanged
+ */
+ public DistributedReplicantManagerImpl(HAPartition partition)
+ {
+ this.partition = partition;
+ this.log = Logger.getLogger(DistributedReplicantManagerImpl.class.getName() +
+ "." + partition.getPartitionName());
+ this.trace = log.isTraceEnabled();
+ }
// Public --------------------------------------------------------
- public void init() throws Exception
+ public void create() throws Exception
{
log.debug("registerRPCHandler");
partition.registerRPCHandler(SERVICE_NAME, this);
@@ -115,21 +129,11 @@
partition.subscribeToStateTransferEvents(SERVICE_NAME, this);
log.debug("registerMembershipListener");
partition.registerMembershipListener(this);
-
- // subscribed this "sub-service" of HAPartition with JMX
- // TODO: In the future (when state transfer issues will be completed),
- // we will need to redesign the way HAPartitions and its sub-protocols are
- // registered with JMX. They will most probably be independant JMX services.
- //
- String name = "jboss:service=" + SERVICE_NAME +
- ",partitionName=" + this.partition.getPartitionName();
- this.jmxName = new javax.management.ObjectName(name);
- this.mbeanserver.registerMBean(this, jmxName);
- }
+ }
public void start() throws Exception
{
- this.nodeName = this.partition.getNodeName ();
+ this.nodeName = this.partition.getNodeName();
// Create the asynch listener handler thread
asynchHandler = new AsynchEventHandler(this, "AsynchKeyChangeHandler");
@@ -173,14 +177,27 @@
}
}
}
-
- this.mbeanserver.unregisterMBean (this.jmxName);
partition.unregisterRPCHandler(SERVICE_NAME, this);
partition.unsubscribeFromStateTransferEvents(SERVICE_NAME, this);
partition.unregisterMembershipListener(this);
}
+ public void registerWithJmx(MBeanServer server) throws Exception
+ {
+ server.registerMBean(this, getObjectName());
+ }
+
+ public void unregisterWithJmx(MBeanServer server) throws Exception
+ {
+ server.unregisterMBean(getObjectName());
+ }
+
+ private ObjectName getObjectName() throws Exception
+ {
+ return new ObjectName("jboss:service=" + SERVICE_NAME + ",partition=" + partition.getPartitionName());
+ }
+
public String listContent () throws Exception
{
// we merge all replicants services: local only or not
More information about the jboss-cvs-commits
mailing list