[jboss-cvs] JBossAS SVN: r81751 - in trunk: cluster/src/main/org/jboss/ha/framework/server and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 27 22:40:30 EST 2008


Author: bstansberry at jboss.com
Date: 2008-11-27 22:40:30 -0500 (Thu, 27 Nov 2008)
New Revision: 81751

Added:
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java
Modified:
   trunk/cluster/src/etc/cluster-jboss-beans.xml
   trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
   trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java
   trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
   trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImplMBean.java
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java
   trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/partition-passexp-jboss-beans.xml
   trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml
   trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml
   trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml
Log:
[JBAS-6201] Eliminate injection of DistributedReplicantManagerImpl into ClusterPartition
[JBAS-6523] Management interface for HAPartition and DRM

Modified: trunk/cluster/src/etc/cluster-jboss-beans.xml
===================================================================
--- trunk/cluster/src/etc/cluster-jboss-beans.xml	2008-11-28 00:57:55 UTC (rev 81750)
+++ trunk/cluster/src/etc/cluster-jboss-beans.xml	2008-11-28 03:40:30 UTC (rev 81751)
@@ -25,7 +25,7 @@
 
       <depends>jboss:service=Naming</depends>
     	 
-      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=HAPartition,partition=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=HAPartition,partition=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class, registerDirectly=true)</annotation>
       
    	<!-- ClusterPartition requires a Cache for state management -->
       <property name="cacheHandler"><inject bean="HAPartitionCacheHandler"/></property>
@@ -45,13 +45,6 @@
       <!-- Optionally provide a thread source to allow async connect of our channel -->
       <property name="threadPool"><inject bean="jboss.system:service=ThreadPool"/></property>
       
-      <property name="distributedReplicantManagerImpl">
-         <bean name="DistributedReplicantManager"
-   		    class="org.jboss.ha.framework.server.DistributedReplicantManagerImpl">      
-            <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=DistributedReplicantManager,partitionName=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.framework.server.DistributedReplicantManagerImplMBean.class, registerDirectly=true)</annotation>
-         </bean>
-      </property>
-      
       <property name="distributedStateImpl">
 	      <bean name="DistributedState"
 	   		 class="org.jboss.ha.framework.server.DistributedStateImpl">	      
@@ -62,4 +55,13 @@
       
    </bean>
    
+   <!--  Expose the DRM for management -->
+   <bean name="DistributedReplicantManager"
+         class="org.jboss.ha.framework.server.DistributedReplicantManagerImpl">      
+       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=DistributedReplicantManager,partitionName=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.framework.server.DistributedReplicantManagerImplMBean.class, registerDirectly=true)</annotation>
+       <constructor factoryMethod="getDistributedReplicantManagerImpl">
+          <factory bean="HAPartition"/>
+       </constructor>
+   </bean>
+   
 </deployment>

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2008-11-28 00:57:55 UTC (rev 81750)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2008-11-28 03:40:30 UTC (rev 81751)
@@ -39,6 +39,10 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
 
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.Name;
@@ -49,7 +53,6 @@
 import org.jboss.bootstrap.spi.util.ServerConfigUtil;
 import org.jboss.ha.framework.interfaces.ClusterNode;
 import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
-//import org.jboss.ha.framework.interfaces.DistributedState;
 import org.jboss.ha.framework.interfaces.HAPartition;
 import org.jboss.ha.framework.interfaces.ResponseFilter;
 import org.jboss.ha.framework.server.deployers.DefaultHAPartitionDependencyCreator;
@@ -61,6 +64,15 @@
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedOperation.Impact;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementObjectRef;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
 import org.jboss.naming.NonSerializableFactory;
 import org.jboss.system.ServiceMBeanSupport;
 import org.jboss.util.threadpool.ThreadPool;
@@ -94,6 +106,13 @@
  * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
  * @version $Revision$
  */
+ at ManagementObject(componentType=@ManagementComponent(type="MCBean", subtype="HAPartition"),
+                  properties=ManagementProperties.CLASS_AND_EXPLICIT,
+                  classProperties={@ManagementProperty(name="stateString",use={ViewUse.STATISTIC})},
+                  operations={@ManagementOperation(name="create",description="Bring the service to the CREATED state",impact=Impact.WriteOnly),
+                              @ManagementOperation(name="start",description="Bring the service to the STARTED state",impact=Impact.WriteOnly),
+                              @ManagementOperation(name="stop",description="Bring the service to the STOPPED state",impact=Impact.WriteOnly),
+                              @ManagementOperation(name="destroy",description="Bring the service to the DESTROYED state",impact=Impact.WriteOnly)})
 public class ClusterPartition
    extends ServiceMBeanSupport
    implements ExtendedMembershipListener, HAPartition,
@@ -198,47 +217,46 @@
    /** Thread pool used to asynchronously start our channel */
    private   ThreadPool threadPool;
    
-   protected Map<String, Object> rpcHandlers = new ConcurrentHashMap<String, Object>();
-   protected Map<String, HAPartitionStateTransfer> stateHandlers = new HashMap<String, HAPartitionStateTransfer>();
+   private final Map<String, Object> rpcHandlers = new ConcurrentHashMap<String, Object>();
+   private final Map<String, HAPartitionStateTransfer> stateHandlers = new HashMap<String, HAPartitionStateTransfer>();
    /** Do we send any membership change notifications synchronously? */
-   protected boolean allowSyncListeners = false;
+   private boolean allowSyncListeners = false;
    /** The HAMembershipListener and HAMembershipExtendedListeners */
-   protected ArrayList<HAMembershipListener> synchListeners = new ArrayList<HAMembershipListener>();
+   private final ArrayList<HAMembershipListener> synchListeners = new ArrayList<HAMembershipListener>();
    /** The asynch HAMembershipListener and HAMembershipExtendedListeners */
-   protected ArrayList<HAMembershipListener> asynchListeners = new ArrayList<HAMembershipListener>();
+   private final ArrayList<HAMembershipListener> asynchListeners = new ArrayList<HAMembershipListener>();
    /** The handler used to send membership change notifications asynchronously */
-   protected AsynchEventHandler asynchHandler;
+   private AsynchEventHandler asynchHandler;
    /** The current cluster partition members */
-   protected Vector<ClusterNode> members = null;
-   protected Vector<Address> jgmembers = null;
-   protected Map<String, WeakReference<ClassLoader>> clmap =
-                                          new ConcurrentHashMap<String, WeakReference<ClassLoader>>();
+   private Vector<ClusterNode> members = null;
+   private Vector<Address> jgmembers = null;
+   private final Map<String, WeakReference<ClassLoader>> clmap = new ConcurrentHashMap<String, WeakReference<ClassLoader>>();
 
-   public Vector<String> history = new Vector<String>();
+   private final Vector<String> history = new Vector<String>();
 
    /** The partition members other than this node */
-   protected Vector<ClusterNode> otherMembers = null;
-   protected Vector<Address> jgotherMembers = null;
+   private Vector<ClusterNode> otherMembers = null;
+   private Vector<Address> jgotherMembers = null;
    /** the local JG IP Address */
-   protected Address localJGAddress = null;
+   private Address localJGAddress = null;
    /** The cluster transport protocol address string */
-   protected String nodeName;
+   private String nodeName;
    /** me as a ClusterNode */
-   protected ClusterNode me = null;
+   private ClusterNode me = null;
    /** The JGroups partition channel */
-   protected Channel channel;
+   private Channel channel;
    /** The cluster replicant manager */
-   protected DistributedReplicantManagerImpl replicantManager;
+   private DistributedReplicantManagerImpl replicantManager;
    /** The DistributedState service we manage */
    @SuppressWarnings("deprecation")
-   protected org.jboss.ha.framework.interfaces.DistributedState distributedState;
+   private org.jboss.ha.framework.interfaces.DistributedState distributedState;
    /** The cluster instance log category */
-   protected Logger log = Logger.getLogger(HAPartition.class.getName());;
-   protected Logger clusterLifeCycleLog = Logger.getLogger(HAPartition.class.getName() + ".lifecycle");
+   private Logger log = Logger.getLogger(HAPartition.class.getName());;
+   private Logger clusterLifeCycleLog = Logger.getLogger(HAPartition.class.getName() + ".lifecycle");
    /** The current cluster view id */
-   protected long currentViewId = -1;
+   private long currentViewId = -1;
    /** Whether to bind the partition into JNDI */
-   protected boolean bindIntoJndi = true;
+   private boolean bindIntoJndi = true;
    
    private final ThreadGate flushBlockGate = new ThreadGate();
    
@@ -252,11 +270,11 @@
    /**
     * An exception occuring upon fetch serviceState.
     */
-   protected Exception setStateException;
+   private Exception setStateException;
    /**
     * An exception occuring during channel connect
     */
-   protected Exception connectException;
+   private Exception connectException;
    private final Object channelLock = new Object();
    private final MessageListenerAdapter messageListener = new MessageListenerAdapter();
    
@@ -306,9 +324,11 @@
    {
       if (this.replicantManager == null)
       {
-         throw new IllegalStateException("DistributedReplicantManager property must be set before creating ClusterPartition service");
+         this.replicantManager = new DistributedReplicantManagerImpl(this);
       }
 
+//      registerDRM();
+      
       this.setupLoggers(this.getPartitionName());
       
       this.replicantManager.createService();
@@ -319,8 +339,7 @@
       }
       
       // Create the asynchronous handler for view changes
-      this.asynchHandler = new AsynchEventHandler(this, "AsynchViewChangeHandler");
-      
+      this.asynchHandler = new AsynchEventHandler(this, "AsynchViewChangeHandler");      
 
       // Add a well-known MC alias that other beans can depend on
       addCanonicalAlias();
@@ -519,6 +538,8 @@
       }
 
       this.replicantManager.destroyService();
+      
+//      unregisterDRM();
 
       try
       {
@@ -945,11 +966,14 @@
 
    // HAPartition implementation ----------------------------------------------
    
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The identifier for this node in cluster topology views")
    public String getNodeName()
    {
       return this.nodeName;
    }
    
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The partition's name")
+   @ManagementObjectID(type="HAPartition")
    public String getPartitionName()
    {
       return this.partitionName;
@@ -971,11 +995,13 @@
       return this.distributedState;
    }
 
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="Identifier for the current topology view")
    public long getCurrentViewId()
    {
       return this.currentViewId;
    }
    
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The current cluster topology view")
    public Vector<String> getCurrentView()
    {
       Vector<String> result = new Vector<String>(this.members.size());
@@ -999,6 +1025,7 @@
       return this.me;
    }
 
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="Whether this node is acting as the group coordinator for the partition")
    public boolean isCurrentNodeCoordinator ()
    {
       if(this.members == null || this.members.size() == 0 || this.me == null)
@@ -1013,7 +1040,7 @@
    // RPC multicast communication
    // ***************************
    // ***************************
-   //
+   
    public void registerRPCHandler(String objName, Object subscriber)
    {
       this.rpcHandlers.put(objName, subscriber);
@@ -1034,18 +1061,21 @@
    /**
     * This function is an abstraction of RpcDispatcher.
     */
+   @SuppressWarnings("unchecked")
    public ArrayList callMethodOnCluster(String objName, String methodName,
       Object[] args, Class[] types, boolean excludeSelf) throws Exception
    {
       return this.callMethodOnCluster(objName, methodName, args, types, excludeSelf, null);
    }
    
+   @SuppressWarnings("unchecked")
    public ArrayList callMethodOnCluster(String objName, String methodName, 
       Object[] args, Class[] types, boolean excludeSelf, ResponseFilter filter) throws Exception
    {
       return this.callMethodOnCluster(objName, methodName, args, types, excludeSelf, this.getMethodCallTimeout(), filter);
    }   
 
+   @SuppressWarnings("unchecked")
    public ArrayList callMethodOnCluster(String objName, String methodName,
        Object[] args, Class[] types, boolean excludeSelf, long methodTimeout, ResponseFilter filter) throws Exception
    {
@@ -1093,6 +1123,7 @@
     * @return an array of responses from remote nodes
     * @throws Exception
     */
+   @SuppressWarnings("unchecked")
    public ArrayList callMethodOnCoordinatorNode(String objName, String methodName,
           Object[] args, Class[] types,boolean excludeSelf) throws Exception
    {
@@ -1112,6 +1143,7 @@
     * @return an array of responses from remote nodes
     * @throws Exception
     */
+   @SuppressWarnings("unchecked")
    public ArrayList callMethodOnCoordinatorNode(String objName, String methodName,
           Object[] args, Class[] types,boolean excludeSelf, long methodTimeout) throws Exception
    {
@@ -1151,6 +1183,7 @@
      * @return the value returned by the target method
      * @throws Exception Throws if a communication exception occurs
      */
+   @SuppressWarnings("unchecked")
    public Object callMethodOnNode(String serviceName, String methodName,
            Object[] args, Class[] types, long methodTimeout, ClusterNode targetNode) throws Throwable
     {
@@ -1218,6 +1251,7 @@
      * @return none
      * @throws Exception Throws if a communication exception occurs
      */
+   @SuppressWarnings("unchecked")
    public void callAsyncMethodOnNode(String serviceName, String methodName,
            Object[] args, Class[] types, long methodTimeout, ClusterNode targetNode) throws Throwable
    {
@@ -1283,6 +1317,7 @@
    /**
     * This function is an abstraction of RpcDispatcher for asynchronous messages
     */
+   @SuppressWarnings("unchecked")
    public void callAsynchMethodOnCluster(String objName, String methodName,
       Object[] args, Class[] types, boolean excludeSelf) throws Exception
    {
@@ -1319,7 +1354,7 @@
    // State transfer management
    // *************************
    // *************************
-   //
+   
    public void subscribeToStateTransferEvents(String objectName, HAPartitionStateTransfer subscriber)
    {
       this.stateHandlers.put(objectName, subscriber);
@@ -1335,7 +1370,7 @@
    // Group Membership listeners
    // *************************
    // *************************
-   //
+   
    public void registerMembershipListener(HAMembershipListener listener)
    {
       boolean isAsynch = (this.allowSyncListeners == false)
@@ -1370,11 +1405,26 @@
       }
    }
    
+   @ManagementProperty(use={ViewUse.CONFIGURATION, ViewUse.RUNTIME}, 
+         description="Whether to allow synchronous notifications of topology changes")
    public boolean getAllowSynchronousMembershipNotifications()
    {
       return this.allowSyncListeners;
    }
 
+   /**
+    * Sets whether this partition will synchronously notify any 
+    * HAPartition.HAMembershipListener of membership changes using the  
+    * calling thread from the underlying group communications layer
+    * (e.g. JGroups).
+    * 
+    * @param allowSync  <code>true</code> if registered listeners that don't 
+    *         implement <code>AsynchHAMembershipExtendedListener</code> or
+    *         <code>AsynchHAMembershipListener</code> should be notified
+    *         synchronously of membership changes; <code>false</code> if
+    *         those listeners can be notified asynchronously.  Default
+    *         is <code>false</code>.
+    */
    public void setAllowSynchronousMembershipNotifications(boolean allowSync)
    {
       this.allowSyncListeners = allowSync;
@@ -1397,23 +1447,8 @@
    public void setDistributedStateImpl(org.jboss.ha.framework.interfaces.DistributedState distributedState)
    {
       this.distributedState = distributedState;
-   }
+   }   
    
-   public void setDistributedReplicantManagerImpl(DistributedReplicantManagerImpl drm)
-   {
-      if (this.replicantManager != null  && !(this.replicantManager == drm))
-      {
-         throw new IllegalStateException("DistributedReplicantManager already set");
-      }
-
-      this.replicantManager = drm;
-      if (this.replicantManager != null)
-      {
-         this.replicantManager.setHAPartition(this);
-      }
-   }
-   
-   
    // Protected -----------------------------------------------------
 
    protected void verifyNodeIsUnique () throws IllegalStateException
@@ -1581,6 +1616,7 @@
     * 
     * @return true if the partition has been bound into JNDI.
     */
+   @ManagementProperty(description="Whether this HAPartition should bind itself into JNDI")
    public boolean getBindIntoJndi()
    {
        return this.bindIntoJndi;
@@ -1637,7 +1673,10 @@
 
    // --------------------------------------------------- ClusterPartitionMBean
    
-   public String showHistory ()
+   @ManagementOperation(description="Gets a listing of significant events since " +
+   		                            "the instantiation of this service",
+                        impact=Impact.ReadOnly)
+   public String showHistory()
    {
       StringBuffer buff = new StringBuffer();
       Vector<String> data = new Vector<String>(this.history);
@@ -1649,7 +1688,10 @@
       return buff.toString();
    }
 
-   public String showHistoryAsXML ()
+   @ManagementOperation(description="Gets an XML format listing of significant events since " +
+                                    "the instantiation of this service",
+                        impact=Impact.ReadOnly)
+   public String showHistoryAsXML()
    {
       StringBuffer buff = new StringBuffer();
       buff.append("<events>\n");
@@ -1691,21 +1733,37 @@
       log.warn("Property deadlockDetection has been deprecated; setting it has no effect");
    }
 
+   @Deprecated
    public HAPartition getHAPartition()
    {
       return this;
    }
 
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The release version of JGroups")
    public String getJGroupsVersion()
    {
       return Version.description + "( " + Version.cvs + ")";
    }
+   
+   @ManagementProperty(name="distributedReplicantManager", use={ViewUse.STATISTIC}, description="The DistributedReplicantManager")
+   @ManagementObjectRef(type="DistributedReplicantManager")
+   public String getDRMName()
+   {
+      return getPartitionName();
+   }
+   
+   public DistributedReplicantManagerImpl getDistributedReplicantManagerImpl()
+   {
+      return this.replicantManager;
+   }
 
+   // FIXME -- Make this a @ManagementProperty
    public ChannelFactory getChannelFactory()
    {
       return this.channelFactory;
    }
 
+   // FIXME -- Make this a @ManagementProperty
    public HAPartitionCacheHandler getCacheHandler()
    {
       return this.cacheHandler;
@@ -1717,11 +1775,14 @@
       this.cacheConfigName = cacheHandler == null ? null : cacheHandler.getCacheConfigName();
    }
 
+   @ManagementProperty(use={ViewUse.STATISTIC}, 
+         description="Name of the CacheManager configuration used for deriving the JGroups channel stack name")
    public String getCacheConfigName()
    {
       return this.cacheConfigName;
    }
-
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="Name of the JGroups protocol stack configuration")
    public String getChannelStackName()
    {
       return this.stackName;
@@ -1737,6 +1798,7 @@
       this.nodeAddress = address;
    }
 
+   @ManagementProperty(description="Time (in ms) to allow for state transfer to finish")
    public long getStateTransferTimeout() {
       return this.state_transfer_timeout;
    }
@@ -1746,6 +1808,8 @@
       this.state_transfer_timeout = timeout;
    }
 
+   @ManagementProperty(use={ViewUse.CONFIGURATION, ViewUse.RUNTIME},
+         description="Time (in ms) to allow for group RPCs to return")
    public long getMethodCallTimeout() {
       return this.method_call_timeout;
    }
@@ -1842,7 +1906,16 @@
       mvos.flush();
       return baos.toByteArray();
    }
+
+//   @Override
+//   public void postRegister(Boolean registrationDone)
+//   {
+//      super.postRegister(registrationDone);
+//      registerDRM();
+//   }
    
+   
+   
    // Private -------------------------------------------------------
    
    // Inner classes -------------------------------------------------
@@ -2280,4 +2353,48 @@
       }
    }
    
+//   private synchronized void registerDRM()
+//   {
+//      MBeanServer mbs = getServer();
+//      if (this.replicantManager != null && mbs != null)
+//      {
+//         try
+//         {
+//            ObjectName oname = getDRMObjectName();
+//            mbs.registerMBean(this.replicantManager, oname);
+//         }
+//         catch (JMException e)
+//         {
+//            log.error("Unable to register DRM in JMX", e);
+//         }
+//      }
+//   }
+   
+//   private void unregisterDRM()
+//   {
+//      MBeanServer mbs = getServer();
+//      if (this.replicantManager != null && mbs != null)
+//      {
+//         try
+//         {
+//            ObjectName oname = getDRMObjectName();
+//            if (mbs.isRegistered(oname))
+//            {
+//               mbs.unregisterMBean(oname);
+//            }
+//         }
+//         catch (JMException e)
+//         {
+//            log.error("Unable to register DRM in JMX", e);
+//         }
+//      }
+//      
+//   }
+
+//   private ObjectName getDRMObjectName() throws MalformedObjectNameException
+//   {
+//      ObjectName oname = new ObjectName(DistributedReplicantManagerImpl.OBJECT_NAME_BASE + ",partitionName=" + getPartitionName());
+//      return oname;
+//   }
+   
 }

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java	2008-11-28 00:57:55 UTC (rev 81750)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java	2008-11-28 03:40:30 UTC (rev 81751)
@@ -27,25 +27,27 @@
 import javax.management.ObjectName;
 
 import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
-import org.jboss.ha.framework.interfaces.DistributedState;
 import org.jboss.ha.framework.interfaces.HAPartition;
 import org.jboss.mx.util.ObjectNameFactory;
-import org.jgroups.ChannelFactory;
 
 /** 
- *   MBean interface for ClusterPartition.  It will start a JGroups
- *   channel and initialize the ReplicantManager and DistributedStateService.
+ * MBean interface for ClusterPartition.
  *
- *   @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>.
- *   @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- *   @version $Revision$
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>.
+ * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
+ * @version $Revision$
  *
  * <p><b>Revisions:</b><br>
  */
-
 public interface ClusterPartitionMBean
    extends org.jboss.system.ServiceMBean
 {
+   /**
+    * Not used.
+    * 
+    * @deprecated not used; will be removed in AS 6
+    */
+   @Deprecated
    ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss:service=ClusterPartition");
 
    /**
@@ -55,8 +57,8 @@
    String getPartitionName();
 
    /**
-    * Uniquely identifies this node. MUST be unique accros the whole cluster!
-    * Cannot be changed once the partition has been started (otherwise an exception is thrown)
+    * Uniquely identifies this node across the entire cluster. 
+    * MUST be unique accros the whole cluster!
     */
    String getNodeName();
    
@@ -68,24 +70,23 @@
    /** The version of JGroups this is running on */
    String getJGroupsVersion();
 
-   /* Number of milliseconds to wait until state has been transferred. Increase this value for large states
-      0 = wait forever */
+   /**
+    *  Number of milliseconds to wait until state has been transferred, or
+    *  zero to wait forever. Increase this value for large states
+    */
    long getStateTransferTimeout();
 
-   void setStateTransferTimeout(long timeout);
-
-   /** Max time (in ms) to wait for <em>synchronous</em> group method calls
-    * ({@link HAPartition#callMethodOnCluster(String, String, Object[], Class[], boolean)}) */ 
+   /** Gets the max time (in ms) to wait for <em>synchronous</em> group method calls
+    * ({@link HAPartition#callMethodOnCluster(String, String, Object[], Class[], boolean)}) 
+    */ 
    long getMethodCallTimeout();
 
-   void setMethodCallTimeout(long timeout);
-
    /**
     * Deprecated; always returns <code>false</code>.
     * 
     * @return <code>false</code>
     * 
-    * @deprecated will be removed in next major release
+    * @deprecated will be removed in AS 6
     */
    @Deprecated
    boolean getDeadlockDetection();
@@ -105,38 +106,30 @@
     */
    public boolean getAllowSynchronousMembershipNotifications();
 
-   /**
-    * Sets whether this partition will synchronously notify any 
-    * HAPartition.HAMembershipListener of membership changes using the  
-    * calling thread from the underlying group communications layer
-    * (e.g. JGroups).
-    * 
-    * @param allowSync  <code>true</code> if registered listeners that don't 
-    *         implement <code>AsynchHAMembershipExtendedListener</code> or
-    *         <code>AsynchHAMembershipListener</code> should be notified
-    *         synchronously of membership changes; <code>false</code> if
-    *         those listeners can be notified asynchronously.  Default
-    *         is <code>false</code>.
-    */
-   public void setAllowSynchronousMembershipNotifications(boolean allowSync);
-
    /** Access to the underlying HAPartition without going through JNDI
     *
     * @return the HAPartition for the cluster service
+    * 
+    * @deprecated will be removed in AS 6
     */
+   @Deprecated
    HAPartition getHAPartition ();
    
    /**
     * Access to the DistributedReplicantManager implementation
+    * 
+    * @deprecated will be removed in AS 6
     */
+   @Deprecated
    DistributedReplicantManager getDistributedReplicantManager();
    
    /**
     * Access to the DistributedState implementation
     * 
-    * @deprecated Use JBoss Cache for distributed caching
+    * @deprecated will be removed in AS 6; use JBoss Cache for distributed caching
     */
-   DistributedState getDistributedStateService();
+   @Deprecated
+   org.jboss.ha.framework.interfaces.DistributedState getDistributedStateService();
    
    /**
     * Gets the configuration name under which our cache is registered
@@ -145,11 +138,6 @@
    String getCacheConfigName();
    
    /**
-    * Gets the JGroups channel factory used by ClusterPartition.
-    */
-   ChannelFactory getChannelFactory();
-   
-   /**
     * Gets the name of the JGroups channel protocol stack configuration
     * provided to the {@link #getChannelFactory() channel factory}. 
     */
@@ -158,10 +146,24 @@
    /** Return the list of member nodes that built from the current view
     * @return A Vector Strings representing the host:port values of the nodes
     */
-   Vector getCurrentView();
+   Vector<String> getCurrentView();
 
-   String showHistory ();
+   /**
+    * Gets a listing of significant events since the instantiation of this 
+    * service (e.g. view changes, member suspicions).
+    * 
+    * @return a String with one event per line
+    */
+   String showHistory();
 
+   /**
+    * Gets a listing of significant events since the instantiation of this 
+    * service (e.g. view changes, member suspicions) in an XML format.
+    * 
+    * @return an XML string with each historical event wrapped in an
+    *         "event" element, with all surrounded by an "events" element.
+    * 
+    * @return
+    */
    String showHistoryAsXML ();
-
 }

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java	2008-11-28 00:57:55 UTC (rev 81750)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java	2008-11-28 03:40:30 UTC (rev 81751)
@@ -44,6 +44,15 @@
 import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
 import org.jboss.ha.framework.interfaces.HAPartition;
 import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedOperation.Impact;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementParameter;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
 
 
 /**
@@ -56,6 +65,8 @@
  * @author  <a href="mailto:pferraro at redhat.com">Paul Ferraro</a>
  * @version $Revision$
  */
+ at ManagementObject(componentType=@ManagementComponent(type="MCBean", subtype="DistributedReplicantManager"),
+      properties=ManagementProperties.EXPLICIT)
 public class DistributedReplicantManagerImpl
    implements DistributedReplicantManagerImplMBean,
               HAPartition.HAMembershipExtendedListener,
@@ -64,38 +75,48 @@
 {
    // Constants -----------------------------------------------------
    
+   static final String OBJECT_NAME_BASE = "jboss:service=DistributedReplicantManager";
+   
    static final String SERVICE_NAME = "DistributedReplicantManager";
    
    private static final Class<?>[] add_types = new Class<?>[] { String.class, String.class, Serializable.class };
    private static final Class<?>[] remove_types = new Class<?>[] { String.class, String.class };
 
    // Attributes ----------------------------------------------------
-   private static AtomicInteger threadID = new AtomicInteger();
+   private static final AtomicInteger threadID = new AtomicInteger();
    
-   private ConcurrentMap<String, Serializable> localReplicants = new ConcurrentHashMap<String, Serializable>();
-   private ConcurrentMap<String, ConcurrentMap<String, Serializable>> replicants = new ConcurrentHashMap<String, ConcurrentMap<String, Serializable>>();
-   private ConcurrentMap<String, List<ReplicantListener>> keyListeners = new ConcurrentHashMap<String, List<ReplicantListener>>();
+   private final ConcurrentMap<String, Serializable> localReplicants = new ConcurrentHashMap<String, Serializable>();
+   private final ConcurrentMap<String, ConcurrentMap<String, Serializable>> replicants = new ConcurrentHashMap<String, ConcurrentMap<String, Serializable>>();
+   private final ConcurrentMap<String, List<ReplicantListener>> keyListeners = new ConcurrentHashMap<String, List<ReplicantListener>>();
    private Map<String, Integer> intraviewIdCache = new ConcurrentHashMap<String, Integer>();
    
-   private HAPartition partition;
+   private final HAPartition partition;
    /** The handler used to send replicant change notifications asynchronously */
-   private AsynchEventHandler asynchHandler;
+   private final AsynchEventHandler asynchHandler;
    
-   private Logger log = Logger.getLogger(this.getClass());
-   private boolean trace = this.log.isTraceEnabled();
+   private final Logger log;
    
    private String nodeName = null;
    
    // Works like a simple latch
-   private CountDownLatch partitionNameKnown = new CountDownLatch(1);
+   private volatile CountDownLatch partitionNameKnown = new CountDownLatch(1);
 
    // Static --------------------------------------------------------
    
    // Constructors --------------------------------------------------
-   public DistributedReplicantManagerImpl()
+   
+   public DistributedReplicantManagerImpl(HAPartition partition)
    {
       super();
-
+      
+      if (partition == null)
+      {
+         throw new NullPointerException("partition is null");
+      }
+      
+      this.partition = partition;
+      this.log = Logger.getLogger(this.getClass().getName() + "." + partition.getPartitionName());
+      
       // JBAS-5068 Create the handler early so we don't risk NPEs
       this.asynchHandler = new AsynchEventHandler(this, "AsynchKeyChangeHandler");
    }
@@ -141,7 +162,8 @@
          this.log.warn("Failed to stop asynchHandler", e);
       }
       
-      // TODO reset the latch
+      // Reset the latch
+      this.partitionNameKnown = new CountDownLatch(1);
    }
 
    // NR 200505 : [JBCLUSTER-38] unbind at destroy
@@ -176,16 +198,20 @@
       return new ObjectName("jboss:service=" + SERVICE_NAME + ",partition=" + this.partition.getPartitionName());
    }
    
-   public HAPartition getHAPartition()
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The partition's name")
+   @ManagementObjectID(type="DistributedReplicantManager")
+   public String getPartitionName()
    {
-      return this.partition;
+      return this.partition.getPartitionName();
    }
 
-   public void setHAPartition(HAPartition clusterPartition)
-   {
-      this.partition = clusterPartition;
-   }
+//   public void setHAPartition(HAPartition clusterPartition)
+//   {
+//      this.partition = clusterPartition;
+//   }
    
+   @ManagementOperation(description="List all known keys and the nodes that have registered bindings",
+                        impact=Impact.ReadOnly)
    public String listContent() throws Exception
    {
       StringBuilder result = new StringBuilder();
@@ -229,6 +255,8 @@
       return result.toString();
    }
    
+   @ManagementOperation(description="List in XML format all known services and the nodes that have registered bindings",
+         impact=Impact.ReadOnly)
    public String listXmlContent() throws Exception
    {
       StringBuilder result = new StringBuilder();
@@ -313,7 +341,7 @@
       
       this.intraviewIdCache = (Map) globalState[1];
 
-      if (this.trace)
+      if (this.log.isTraceEnabled())
       {
          this.log.trace(this.nodeName + ": received new state, will republish local replicants");
       }
@@ -321,6 +349,9 @@
       new MembersPublisher().start();
    }
       
+   @ManagementOperation(description="Get a collection of the names of all keys" +
+   		                             " for which we have bindings",
+                        impact=Impact.ReadOnly)
    public Collection<String> getAllServices()
    {
       Set<String> services = new HashSet<String>();
@@ -331,6 +362,7 @@
    
    // HAPartition.HAMembershipListener implementation ----------------------------------------------
 
+   @SuppressWarnings("unchecked")
    public void membershipChangedDuringMerge(Vector deadMembers, Vector newMembers, Vector allMembers, Vector originatingGroups)
    {
       // Here we only care about deadMembers.  Purge all replicant lists of deadMembers
@@ -346,6 +378,7 @@
       }
    }
    
+   @SuppressWarnings("unchecked")
    public void membershipChanged(Vector deadMembers, Vector newMembers, Vector allMembers)
    {
       // Here we only care about deadMembers.  Purge all replicant lists of deadMembers
@@ -379,7 +412,7 @@
    
    public void add(String key, Serializable replicant) throws Exception
    {
-      if (this.trace)
+      if (this.log.isTraceEnabled())
       {
          this.log.trace("add, key=" + key + ", value=" + replicant);
       }
@@ -492,6 +525,11 @@
    }
    
    @Deprecated
+   @ManagementOperation(description="Returns the names of the nodes that have " +
+   		                            " registered objects under the given key",
+                        impact=Impact.ReadOnly,
+                        params={@ManagementParameter(name="key",
+                                                     description="The name of the service")})
    public List<String> lookupReplicantsNodeNames(String key)
    {
       List<ClusterNode> nodes = this.lookupReplicantsNodes(key);
@@ -560,6 +598,11 @@
       }
    }
    
+   @ManagementOperation(description="Returns a hash of the list of nodes that " +
+   		                            "have registered an object for the given key",
+   		                impact=Impact.ReadOnly,
+                        params={@ManagementParameter(name="key",
+                                                     description="The name of the service")})
    public int getReplicantsViewId(String key)
    {
       Integer result = this.intraviewIdCache.get(key);
@@ -569,7 +612,7 @@
    
    public boolean isMasterReplica(String key)
    {
-      if (this.trace)
+      if (this.log.isTraceEnabled())
       {
          this.log.trace("isMasterReplica, key=" + key);
       }
@@ -577,7 +620,7 @@
       //
       if (!this.localReplicants.containsKey(key))
       {
-         if (this.trace)
+         if (this.log.isTraceEnabled())
          {
             this.log.trace("no localReplicants, key=" + key + ", isMasterReplica=false");
          }
@@ -587,7 +630,7 @@
       Map<String, Serializable> repForKey = this.replicants.get(key);
       if (repForKey == null)
       {
-         if (this.trace)
+         if (this.log.isTraceEnabled())
          {
             this.log.trace("no replicants, key=" + key + ", isMasterReplica=true");
          }
@@ -597,14 +640,14 @@
       Vector<String> allNodes = this.partition.getCurrentView();
       for (String node: allNodes)
       {
-         if (this.trace)
+         if (this.log.isTraceEnabled())
          {
             this.log.trace("Testing member: " + node);
          }
          
          if (repForKey.containsKey(node))
          {
-            if (this.trace)
+            if (this.log.isTraceEnabled())
             {
                this.log.trace("Member found in replicaNodes, isMasterReplica=false");
             }
@@ -612,7 +655,7 @@
          }
          else if (node.equals(this.nodeName))
          {
-            if (this.trace)
+            if (this.log.isTraceEnabled())
             {
                this.log.trace("Member == nodeName, isMasterReplica=true");
             }
@@ -632,7 +675,7 @@
     */
    public void _add(String key, String nodeName, Serializable replicant)
    {
-      if (this.trace)
+      if (this.log.isTraceEnabled())
       {
          this.log.trace("_add(" + key + ", " + nodeName);
       }
@@ -721,7 +764,7 @@
       
       Object[] rtn = { this.nodeName, this.localReplicants };
       
-      if (this.trace)
+      if (this.log.isTraceEnabled())
       {
          this.log.trace("lookupLocalReplicants called ("+ rtn[0] + "). Return: " + this.localReplicants.size());
       }
@@ -800,7 +843,7 @@
     */
    protected void notifyKeyListeners(String key, List<Serializable> newReplicants, boolean merge)
    {
-      if (this.trace)
+      if (this.log.isTraceEnabled())
       {
          this.log.trace("notifyKeyListeners");
       }
@@ -813,14 +856,14 @@
 
       if (listeners == null)
       {
-         if (this.trace)
+         if (this.log.isTraceEnabled())
          {
             this.log.trace("listeners is null");
          }
          return;
       }
       
-      if (this.trace)
+      if (this.log.isTraceEnabled())
       {
          this.log.trace("notifying " + listeners.size() + " listeners for key change: " + key);
       }
@@ -838,7 +881,7 @@
    {
       try
       {
-         if (this.trace)
+         if (this.log.isTraceEnabled())
          {
             this.log.trace("Start Re-Publish local replicants in DRM");
          }
@@ -851,7 +894,7 @@
             {
                String key = entry.getKey();
                
-               if (this.trace)
+               if (this.log.isTraceEnabled())
                {
                   this.log.trace("publishing, key=" + key + ", value=" + replicant);
                }
@@ -864,7 +907,7 @@
             }
          }
          
-         if (this.trace)
+         if (this.log.isTraceEnabled())
          {
             this.log.trace("End Re-Publish local replicants");
          }
@@ -918,7 +961,7 @@
                
                Object[] objs = (Object[]) o;
                String node = (String) objs[0];
-               Map<String, Serializable> replicants = (Map) objs[1];
+               Map<String, Serializable> replicants = (Map<String, Serializable>) objs[1];
                
                //FIXME: We don't remove keys in the merge process but only add new keys!
                for (Map.Entry<String, Serializable> entry: replicants.entrySet())

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImplMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImplMBean.java	2008-11-28 00:57:55 UTC (rev 81750)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImplMBean.java	2008-11-28 03:40:30 UTC (rev 81751)
@@ -41,11 +41,12 @@
    extends org.jboss.ha.framework.interfaces.DistributedReplicantManager
 {   
    /**
-    * Get the underlying partition used by this service.
+    * Get the {@link HAPartition#getPartitionName() name of the underlying partition}
+    * used by this service.
     * 
-    * @return the partition
+    * @return the name of the partition
     */
-   HAPartition getHAPartition();
+   String getPartitionName();
    
    String listContent () throws Exception;
    String listXmlContent () throws Exception;

Added: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java	2008-11-28 03:40:30 UTC (rev 81751)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.cluster.defaultcfg.test;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.NameMatcher;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.test.profileservice.test.AbstractProfileServiceTest;
+
+/**
+ * Validates the expected HAPartition-related ManagedObjects are there
+ * 
+ * @author Brian Stansberry
+ * @version $Revision:$
+ */
+public class ClusterPartitionManagedObjectsTestCase
+   extends AbstractProfileServiceTest
+{
+   protected ManagementView activeView;
+   private String partitionName = System.getProperty("jbosstest.partitionName", "DefaultPartition");
+
+   public ClusterPartitionManagedObjectsTestCase(String name)
+   {
+      super(name);
+   }
+   /**
+    * Look at the HAPartition ManagedComponent
+    * @throws Exception
+    */
+   public void testHAPartition()
+      throws Exception
+   {
+      ManagementView mgtView = getManagementView();
+//      ComponentType type = new ComponentType("MCBean", "Clustering");
+//      Set<ManagedComponent> mcs = mgtView.getMatchingComponents(this.partitionName, type, 
+//            new NameTypeQualifiedNameMatcher("HAPartition"));
+//      assertEquals("There is just one HAPartition component", 1, mcs.size());
+//      ManagedComponent mc = mcs.iterator().next();     
+      ComponentType type = new ComponentType("MCBean", "HAPartition");
+      ManagedComponent mc = mgtView.getComponent(this.partitionName, type);
+      validateHAPartitionManagedComponent(mc);
+   }
+   
+   private void validateHAPartitionManagedComponent(ManagedComponent mc)
+   {
+      assertNotNull(mc);
+      assertEquals("HAPartition", mc.getNameType());
+      assertEquals("DefaultPartition", mc.getName());
+      
+      for (ManagedOperation mo : mc.getOperations())
+         getLog().debug(mo);
+      
+      for (Map.Entry<String, ManagedProperty> entry : mc.getProperties().entrySet())
+      {
+         getLog().debug(entry.getKey() + " == " + entry.getValue());
+         ManagedObject mo = entry.getValue().getTargetManagedObject();
+         if (mo != null)
+         {
+            getLog().debug(entry.getKey() + " -- ManagedObject == " + mo);
+         }
+      }
+   }
+
+   /**
+    * Look at the DistributedReplicantManager ManagedComponent
+    * @throws Exception
+    */
+   public void testDistributedReplicantManager()
+      throws Exception
+   {
+      ManagementView mgtView = getManagementView();
+//      ComponentType type = new ComponentType("MCBean", "Clustering");
+//      Set<ManagedComponent> mcs = mgtView.getMatchingComponents(this.partitionName, type, 
+//            new NameTypeQualifiedNameMatcher("DistributedReplicantManager"));
+//      assertEquals("There is just one DistributedReplicantManager component", 1, mcs.size());
+//      ManagedComponent mc = mcs.iterator().next();       
+      ComponentType type = new ComponentType("MCBean", "DistributedReplicantManager");
+      ManagedComponent mc = mgtView.getComponent(this.partitionName, type);   
+      validateDRMManagedComponent(mc);
+   }
+
+   private void validateDRMManagedComponent(ManagedComponent mc)
+   {
+      assertNotNull(mc);
+      assertEquals("DistributedReplicantManager", mc.getNameType());
+      assertEquals("DefaultPartition", mc.getName());      
+   }
+
+   @Override
+   protected String getProfileName()
+   {
+      return "cluster-udp-0";
+   }
+   
+   private static class NameTypeQualifiedNameMatcher implements NameMatcher<ManagedComponent>
+   {
+      private final String nameType;
+      
+      public NameTypeQualifiedNameMatcher(String nameType)
+      {
+         this.nameType = nameType;
+      }
+
+      public boolean matches(ManagedComponent comp, String name)
+      {
+         return name.equals(comp.getName()) && nameType.equals(comp.getNameType());
+      }
+      
+      
+   }
+
+}

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java	2008-11-28 00:57:55 UTC (rev 81750)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java	2008-11-28 03:40:30 UTC (rev 81751)
@@ -32,7 +32,6 @@
 
 import junit.framework.Test;
 
-//import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Configuration;
 import org.jboss.ha.cachemanager.CacheManager;
 import org.jboss.ha.cachemanager.DependencyInjectedConfigurationRegistry;
@@ -45,7 +44,6 @@
 import org.jboss.ha.framework.server.DistributedStateImpl;
 import org.jboss.ha.framework.server.HAPartitionCacheHandlerImpl;
 import org.jboss.ha.framework.server.JChannelFactory;
-import org.jboss.ha.framework.server.spi.HAPartitionCacheHandler;
 import org.jboss.logging.Logger;
 import org.jboss.test.JBossClusteredTestCase;
 import org.jboss.test.cluster.hapartition.drm.MockHAPartition;
@@ -547,21 +545,20 @@
          
          DistributedStateImpl ds1 = new DistributedStateImpl();
          ds1.setCacheHandler(cacheHandler1);
-
-         DistributedReplicantManagerImpl drm1 = new DistributedReplicantManagerImpl();
          
          partition1 = new ClusterPartition();
          partition1.setPartitionName(partitionName);
          partition1.setCacheHandler(cacheHandler1);
          partition1.setStateTransferTimeout(30000);
          partition1.setMethodCallTimeout(60000);
-         partition1.setDistributedReplicantManagerImpl(drm1);
          partition1.setDistributedStateImpl(ds1);
          partition1.setBindIntoJndi(false);
          
          partition1.create();         
          partition1.start();
 
+         DistributedReplicantManager drm1 = partition1.getDistributedReplicantManager();
+
          Thread.sleep(10000);
          
          // Use a different stack name with the same config to avoid singleton conflicts
@@ -592,19 +589,18 @@
          DistributedStateImpl ds2 = new DistributedStateImpl();
          ds2.setCacheHandler(cacheHandler2);
          
-         DistributedReplicantManagerImpl drm2 = new DistributedReplicantManagerImpl();
-         
          partition2 = new ClusterPartition();
          partition2.setPartitionName(partitionName);
          partition2.setCacheHandler(cacheHandler2);
          partition2.setStateTransferTimeout(30000);
          partition2.setMethodCallTimeout(60000);
-         partition2.setDistributedReplicantManagerImpl(drm2);
          partition2.setDistributedStateImpl(ds2);
          partition2.setBindIntoJndi(false);
          
          partition2.create();         
          partition2.start();
+
+         DistributedReplicantManager drm2 = partition2.getDistributedReplicantManager();
          
          Thread.sleep(10000);
          
@@ -741,18 +737,17 @@
          ClusterNode localAddress = new ClusterNodeImpl(new IpAddress("127.0.0.1", 12345));
          MockHAPartition partition = new MockHAPartition(localAddress);
       
-         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl();
-         drm.setHAPartition(partition);
+         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);
 
          drm.createService();
          
          // Create a fake view for the MockHAPartition
          
-         Vector remoteAddresses = new Vector();
+         Vector<ClusterNode> remoteAddresses = new Vector<ClusterNode>();
          for (int i = 1; i < 5; i++)
             remoteAddresses.add(new ClusterNodeImpl(new IpAddress("127.0.0.1", 12340 + i)));
          
-         Vector allNodes = new Vector(remoteAddresses);
+         Vector<ClusterNode> allNodes = new Vector<ClusterNode>(remoteAddresses);
          allNodes.add(localAddress);
          partition.setCurrentViewClusterNodes(allNodes);
          
@@ -846,18 +841,17 @@
          ClusterNode localAddress = new ClusterNodeImpl(new IpAddress("127.0.0.1", 12345));
          MockHAPartition partition = new MockHAPartition(localAddress);
       
-         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl();
-         drm.setHAPartition(partition);
+         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);
 
          drm.createService();
          
          // Create a fake view for the MockHAPartition
          
-         Vector remoteAddresses = new Vector();
+         Vector<ClusterNode> remoteAddresses = new Vector<ClusterNode>();
          for (int i = 1; i < 5; i++)
             remoteAddresses.add(new ClusterNodeImpl(new IpAddress("127.0.0.1", 12340 + i)));
          
-         Vector allNodes = new Vector(remoteAddresses);
+         Vector<ClusterNode> allNodes = new Vector<ClusterNode>(remoteAddresses);
          allNodes.add(localAddress);
          partition.setCurrentViewClusterNodes(allNodes);
          
@@ -965,18 +959,17 @@
          ClusterNode localAddress = new ClusterNodeImpl(new IpAddress("127.0.0.1", 12345));
          MockHAPartition partition = new MockHAPartition(localAddress);
       
-         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl();
-         drm.setHAPartition(partition);
+         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);
 
          drm.createService();
          
          // Create a fake view for the MockHAPartition
          
-         Vector remoteAddresses = new Vector();
+         Vector<ClusterNode> remoteAddresses = new Vector<ClusterNode>();
          ClusterNode remote = new ClusterNodeImpl(new IpAddress("127.0.0.1", 12341));
          remoteAddresses.add(remote);
          
-         Vector allNodes = new Vector(remoteAddresses);
+         Vector<ClusterNode> allNodes = new Vector<ClusterNode>(remoteAddresses);
          allNodes.add(localAddress);
          partition.setCurrentViewClusterNodes(allNodes);
          
@@ -1142,7 +1135,7 @@
          ClusterNode[] nodes = new ClusterNode[5];
          String[] names = new String[nodes.length];
          Integer[] replicants = new Integer[nodes.length];
-         Vector allNodes = new Vector();
+         Vector<ClusterNode> allNodes = new Vector<ClusterNode>();
          for (int i = 0; i < nodes.length; i++)
          {
             nodes[i] = new ClusterNodeImpl(new IpAddress("127.0.0.1", 12340 + i));
@@ -1154,8 +1147,7 @@
          MockHAPartition partition = new MockHAPartition(nodes[2]);
          partition.setCurrentViewClusterNodes(allNodes);
          
-         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl();
-         drm.setHAPartition(partition);
+         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);
          drm.createService();
          drm.startService();
          
@@ -1220,7 +1212,7 @@
          ClusterNode[] nodes = new ClusterNode[5];
 //         String[] names = new String[nodes.length];
          Integer[] replicants = new Integer[nodes.length];
-         Vector allNodes = new Vector();
+         Vector<ClusterNode> allNodes = new Vector<ClusterNode>();
          for (int i = 0; i < nodes.length; i++)
          {
             nodes[i] = new ClusterNodeImpl(new IpAddress("127.0.0.1", 12340 + i));
@@ -1232,8 +1224,7 @@
          MockHAPartition partition = new MockHAPartition(nodes[2]);
          partition.setCurrentViewClusterNodes(allNodes);
          
-         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl();
-         drm.setHAPartition(partition);
+         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);
          drm.createService();
          drm.startService();
          

Modified: trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/partition-passexp-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/partition-passexp-jboss-beans.xml	2008-11-28 00:57:55 UTC (rev 81750)
+++ trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/partition-passexp-jboss-beans.xml	2008-11-28 03:40:30 UTC (rev 81751)
@@ -134,12 +134,6 @@
       <!-- Max time (in ms) to wait for RPC calls to complete. -->
       <property name="methodCallTimeout">60000</property>
       
-      <property name="distributedReplicantManagerImpl">
-   		<bean name="PassExpPartitionDRM" class="org.jboss.ha.framework.server.DistributedReplicantManagerImpl">             
-      		<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=PassExpPartitionDRM,partitionName=PassExpPartition", exposedInterface=org.jboss.ha.framework.server.DistributedReplicantManagerImplMBean.class, registerDirectly=true)</annotation>
-      	</bean>
-      </property>
-      
       <property name="distributedStateImpl">
 		   <bean name="PassExpDistributedState"
 		   		 class="org.jboss.ha.framework.server.DistributedStateImpl">		      

Modified: trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml	2008-11-28 00:57:55 UTC (rev 81750)
+++ trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml	2008-11-28 03:40:30 UTC (rev 81751)
@@ -346,14 +346,8 @@
       <property name="stateTransferTimeout">2000</property>
               
       <!-- Max time (in ms) to wait for RPC calls to complete. -->
-      <property name="methodCallTimeout">5000</property> 
+      <property name="methodCallTimeout">5000</property>
      
-     <property name="distributedReplicantManagerImpl">
-     		<bean name="ElectionPolicyTestPartitionDRM" class="org.jboss.ha.framework.server.DistributedReplicantManagerImpl">      
-	       	<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=ElectionPolicyTestPartitionDRM,partitionName=ElectionPolicyTestPartition", exposedInterface=org.jboss.ha.framework.server.DistributedReplicantManagerImplMBean.class, registerDirectly=true)</annotation>
-	   	</bean>
-   </property>
-     
    </bean>
 
 </deployment>

Modified: trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml	2008-11-28 00:57:55 UTC (rev 81750)
+++ trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml	2008-11-28 03:40:30 UTC (rev 81751)
@@ -112,14 +112,6 @@
       <!-- Max time (in ms) to wait for RPC calls to complete. -->
       <property name="methodCallTimeout">5000</property> 
       
-      <property name="distributedReplicantManagerImpl">
-   
-		    <bean name="BadProviderPartitionDRM" class="org.jboss.ha.framework.server.DistributedReplicantManagerImpl">      
-		       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=BadProviderPartitionDRM,partitionName=BadProviderPartition", exposedInterface=org.jboss.ha.framework.server.DistributedReplicantManagerImplMBean.class, registerDirectly=true)</annotation>		      	    
-		    </bean>
-		    
-      </property>
-      
       <property name="startupRecorder"><inject bean="BadProviderPartitionRecorder"/></property>
       
       <property name="stateTransferTargets">
@@ -173,12 +165,6 @@
       <!-- Max time (in ms) to wait for RPC calls to complete. -->
       <property name="methodCallTimeout">5000</property>
       
-      <property name="distributedReplicantManagerImpl">  
-		   <bean name="BadStatePartitionDRM" class="org.jboss.ha.framework.server.DistributedReplicantManagerImpl">      
-		       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=BadStatePartitionDRM,partitionName=BadStatePartition", exposedInterface=org.jboss.ha.framework.server.DistributedReplicantManagerImplMBean.class, registerDirectly=true)</annotation>
-		   </bean>
-   	</property>
-      
       <property name="startupRecorder"><inject bean="BadStatePartitionRecorder"/></property>
       
       <property name="stateTransferTargets">
@@ -232,12 +218,6 @@
       <!-- Max time (in ms) to wait for RPC calls to complete. -->
       <property name="methodCallTimeout">5000</property> 
       
-      <property name="distributedReplicantManagerImpl">
-		   <bean name="NoStatePartitionDRM" class="org.jboss.ha.framework.server.DistributedReplicantManagerImpl">      
-		       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=NoStatePartitionDRM,partitionName=NoStatePartition", exposedInterface=org.jboss.ha.framework.server.DistributedReplicantManagerImplMBean.class, registerDirectly=true)</annotation>
-		   </bean>
-   	</property>
-      
       <property name="startupRecorder"><inject bean="NoStatePartitionRecorder"/></property>
       
    </bean>
@@ -274,12 +254,6 @@
       <!-- Max time (in ms) to wait for RPC calls to complete. -->
       <property name="methodCallTimeout">5000</property> 
       
-      <property name="distributedReplicantManagerImpl">   
-		   <bean name="GoodStatePartitionDRM" class="org.jboss.ha.framework.server.DistributedReplicantManagerImpl">      
-		       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=GoodStatePartitionDRM,partitionName=GoodStatePartition", exposedInterface=org.jboss.ha.framework.server.DistributedReplicantManagerImplMBean.class, registerDirectly=true)</annotation>
-		   </bean>
-   	</property>
-      
       <property name="startupRecorder"><inject bean="GoodStatePartitionRecorder"/></property>
       
       <property name="stateTransferTargets">

Modified: trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml	2008-11-28 00:57:55 UTC (rev 81750)
+++ trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml	2008-11-28 03:40:30 UTC (rev 81751)
@@ -123,12 +123,6 @@
       <!-- Max time (in ms) to wait for RPC calls to complete. -->
       <property name="methodCallTimeout">60000</property>
       
-      <property name="distributedReplicantManagerImpl">
-   		<bean name="RestartPartitionDRM" class="org.jboss.ha.framework.server.DistributedReplicantManagerImpl">             
-      		<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=RestartPartitionDRM,partitionName=RestartPartition", exposedInterface=org.jboss.ha.framework.server.DistributedReplicantManagerImplMBean.class, registerDirectly=true)</annotation>
-      	</bean>
-      </property>
-      
       <property name="distributedStateImpl">
 		   <bean name="RestartDistributedState"
 		   		 class="org.jboss.ha.framework.server.DistributedStateImpl">		      




More information about the jboss-cvs-commits mailing list