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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jun 5 09:49:34 EDT 2010


Author: bstansberry at jboss.com
Date: 2010-06-05 09:49:33 -0400 (Sat, 05 Jun 2010)
New Revision: 105748

Removed:
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/AddressPort.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/AsynchEventHandler.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/ChannelInfo.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterNodeFactory.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterNodeImpl.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/DistributedReplicantManagerImplMBean.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/JChannelFactoryMBean.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/ProtocolStackConfigInfo.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/ProtocolStackUtil.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/RspFilterAdapter.java
Modified:
   trunk/cluster/src/etc/hapartition-jboss-beans.xml
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartition.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartitionMBean.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/JChannelFactory.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/managed/OpenChannelsMapper.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/managed/ProtocolStackConfigurationsMapper.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/util/PingJndi.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/util/TopologyMonitorService.java
   trunk/cluster/src/main/java/org/jboss/ha/jndi/LookupSucceededFilter.java
   trunk/cluster/src/main/java/org/jboss/invocation/unified/interfaces/UnifiedInvokerHAProxy.java
   trunk/cluster/src/resources/jgroups/jgroups-channelfactory-jboss-beans.xml
   trunk/component-matrix/pom.xml
   trunk/testsuite/build.xml
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/JChannelFactoryClassLoaderLeakTestCase.java
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/JChannelFactoryOverrideUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/LookupSucceededFilterUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/OpenChannelsMapperUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/PreferredMasterElectionPolicyUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ProtocolStackConfigurationsMapperUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java
   trunk/testsuite/src/main/org/jboss/test/cluster/multicfg/test/HAPartitionStateTransferTestCase.java
   trunk/testsuite/src/main/org/jboss/test/cluster/testutil/MockHAPartition.java
   trunk/testsuite/src/main/org/jboss/test/cluster/testutil/TestClusterNodeFactory.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-8056] Extract core clustering infrastructure from AS cluster module
[JBAS-8057] Base the HAPartition implementation off of the JGroups MuxRpcDispatcher

Modified: trunk/cluster/src/etc/hapartition-jboss-beans.xml
===================================================================
--- trunk/cluster/src/etc/hapartition-jboss-beans.xml	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/etc/hapartition-jboss-beans.xml	2010-06-05 13:49:33 UTC (rev 105748)
@@ -25,10 +25,9 @@
     	 
       <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>
-               
-      <!-- Name of the partition being built -->
+      <property name="channelSource"><inject bean="HAPartitionCacheHandler"/></property>
+      
+   	<!-- Name of the partition being built -->
       <property name="partitionName">${jboss.partition.name:DefaultPartition}</property>
          
       <!-- Max time (in ms) to wait for state transfer to complete. Increase for large states -->
@@ -44,18 +43,21 @@
 	      <bean name="DistributedState"
 	   		 class="org.jboss.ha.framework.server.DistributedStateImpl">	      
 	      	<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=DistributedState,partitionName=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.framework.server.DistributedStateImplMBean.class, registerDirectly=true)</annotation>
-	      	<property name="cacheHandler"><inject bean="HAPartitionCacheHandler"/></property>	               
+	      	<property name="cacheHandler"><inject bean="HAPartitionCacheHandler"/></property>
    		</bean>
       </property>
-
+      
+      <!-- For legacy managed object interface support -->
+      <property name="cacheHandler"><inject bean="HAPartitionCacheHandler"/></property>
+      
       <depends>jboss:service=Naming</depends>
       
    </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>
+         class="org.jboss.ha.core.framework.server.DistributedReplicantManagerImpl">      
+       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=DistributedReplicantManager,partitionName=${jboss.partition.name:DefaultPartition}", exposedInterface=org.jboss.ha.core.framework.server.DistributedReplicantManagerImplMBean.class, registerDirectly=true)</annotation>
        <constructor factoryMethod="getDistributedReplicantManagerImpl">
           <factory bean="HAPartition"/>
        </constructor>

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/AddressPort.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/AddressPort.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/AddressPort.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import java.io.Serializable;
-import java.net.InetAddress;
-
-public class AddressPort implements Serializable
-{
-   /** The serialVersionUID */
-   private static final long serialVersionUID = -1878072081329209058L;
-
-   private InetAddress addr;
-
-   private Integer port;
-
-   public AddressPort(InetAddress addr, Integer port)
-   {
-      this.addr = addr;
-      this.port = port;
-   }
-
-   public Integer getPort()
-   {
-      return this.port;
-   }
-
-   public InetAddress getInetAddress()
-   {
-      return this.addr;
-   }
-
-   public String getHostAddress()
-   {
-      return this.addr.getHostAddress();
-   }
-
-   public String getHostName()
-   {
-      return this.addr.getHostName();
-   }
-
-   @Override
-   public String toString()
-   {
-      return "{host(" + this.addr + "), port(" + this.port + ")}";
-   }
-}
\ No newline at end of file

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/AsynchEventHandler.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/AsynchEventHandler.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/AsynchEventHandler.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,174 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.jboss.logging.Logger;
-
-/**
- * Utility class that accepts objects into a queue and maintains a separate
- * thread that reads them off the queue and passes them to a registered
- * "processor".
- * 
- * @todo find a better home for this than the cluster module
- * 
- * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-class AsynchEventHandler implements Runnable
-{
-   /**
-    * Interface implemented by classes able to process the objects
-    * placed into an AsynchEventHandler's queue.
-    */
-   public static interface AsynchEventProcessor
-   {
-      public void processEvent(Object event);
-   }
-   
-   private String name;
-   /** The LinkedQueue of events to pass to our processor */
-   private BlockingQueue<Object> events = new LinkedBlockingQueue<Object>();
-   /** Whether we're blocking on the queue */
-   private boolean blocking;
-   private AsynchEventProcessor processor;
-   private boolean stopped = true;
-   private Thread  handlerThread;
-   private Logger log;
-   
-   /**
-    * Create a new AsynchEventHandler.
-    * 
-    * @param processor  object to which objects placed in the queue should
-    *                   be handed when dequeued
-    * @param name       name for this instance.  Appended to the processor's
-    *                   class name to create a log category, and used
-    *                   to name to handler thread
-    */
-   public AsynchEventHandler(AsynchEventProcessor processor, String name)
-   {
-      super();
-      this.processor = processor;
-      if (name == null)
-         name = "AsynchEventHandler";
-      this.name = name;
-      this.log = Logger.getLogger(processor.getClass().getName() + "." + name);
-   }
-   
-   /**
-    * Place the given object in the queue.
-    * 
-    * @param event  the object to asynchronously pass to the 
-    *               AsynchEventHandler.
-    *               
-    * @throws InterruptedException  if the thread is interrupted while blocking
-    *                               on the queue.
-    */
-   public void queueEvent(Object event) throws InterruptedException
-   {
-      if (event != null)
-         events.add(event);
-   }
-   
-   public void run()
-   {
-      log.debug("Begin " + name + " Thread");
-      stopped = false;
-      boolean intr = false;
-      try
-      {
-         while( !stopped )
-         {
-            try
-            {
-               blocking = true;
-               Object event = events.take();
-               blocking = false;
-
-               if (!stopped)
-               {
-                  processor.processEvent(event);
-               }
-            }
-            catch(InterruptedException e)
-            {
-               intr = true;
-               blocking = false;
-               if (stopped)
-               {
-                  log.debug(name + " Thread interrupted");
-                  break;
-               }
-               log.error(name + " Thread interrupted", e);
-            }
-            catch (Throwable t)
-            {
-               log.error("Caught Throwable handling asynch events", t);
-            }
-         }
-         log.debug("End " + name + " Thread");
-      }
-      finally
-      {
-         if (intr) Thread.currentThread().interrupt();
-      }
-   }
-   
-   /**
-    * Starts the handler thread.
-    */
-   public void start()
-   {
-      handlerThread = new Thread(this, name + " Thread");
-      handlerThread.start();
-   }
-   
-   /**
-    * Stops the handler thread.
-    */
-   public void stop()
-   {
-      stopped = true;
-      if (blocking)
-         handlerThread.interrupt(); // it's just waiting on the LinkedQueue
-      
-      if (handlerThread.isAlive()) {
-         // Give it up to 100ms to finish whatever it's doing
-         try
-         {
-            handlerThread.join(100);
-         }
-         catch (Exception ignored) {}
-      }
-      
-      if (handlerThread.isAlive())
-         handlerThread.interrupt(); // kill it
-   }
-   
-   public boolean isStopped()
-   {
-      return stopped;
-   }
-
-}

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/ChannelInfo.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/ChannelInfo.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/ChannelInfo.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jgroups.Address;
-import org.jgroups.Channel;
-import org.jgroups.View;
-import org.jgroups.conf.ProtocolData;
-
-/**
- * Information describing an open JGroups Channel.
- *
- * @author Brian Stansberry
- * 
- * @version $Revision: $
- */
-public class ChannelInfo
-{
-   private final String id;
-   private final String stackName;
-   private final Channel channel;
-   private final ProtocolData[] protocolStackConfiguration;
-   private final ObjectName channelObjectName;
-   private final List<ObjectName> protocolObjectNames;
-   
-   public ChannelInfo(String id, String stackName, Channel channel, 
-         ProtocolData[] config, ObjectName channelObjectName, 
-         List<ObjectName> protocolObjectNames)
-   {
-      if (channel == null)
-      {
-         throw new IllegalArgumentException("null channel");
-      }
-      
-      this.id = id;
-      this.stackName = stackName;
-      this.channel = channel;
-      this.protocolStackConfiguration = config;
-      this.channelObjectName = channelObjectName;
-      this.protocolObjectNames = protocolObjectNames;
-   }
-   
-   public String getId()
-   {
-      return id;
-   }
-   
-   public String getClusterName()
-   {
-      return channel.getClusterName();
-   }
-   
-   public String getStackName()
-   {
-      return stackName;
-   }
-   
-   public Channel getChannel()
-   {
-      return channel;
-   }
-   
-   public ProtocolData[] getProtocolStackConfiguration()
-   {
-      return protocolStackConfiguration;
-   }
-   
-   public ObjectName getChannelObjectName()
-   {
-      return channelObjectName;
-   }
-   
-   public List<ObjectName> getProtocolObjectNames()
-   {
-      return protocolObjectNames;
-   } 
-   
-   public Address getLocalAddress()
-   {
-      return this.channel.getLocalAddress();
-   }
-   
-   public View getCurrentView()
-   {
-      return this.channel.getView();
-   }
-}

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterNodeFactory.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterNodeFactory.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterNodeFactory.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import org.jboss.ha.framework.interfaces.ClusterNode;
-import org.jgroups.Address;
-
-/**
- * Factory for ClusterNode(s)
- * 
- * 
- * @see ClusterNodeImpl
- * 
- * @author Vladimir Blagojevic
- */
-public interface ClusterNodeFactory
-{
-
-   public ClusterNode getClusterNode(Address address);
-
-}

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterNodeImpl.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterNodeImpl.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterNodeImpl.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,178 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import java.net.InetAddress;
-import org.jboss.ha.framework.interfaces.ClusterNode;
-import org.jgroups.Address;
-
-/**
- * Replacement for a JG IpAddress that doesn't base its representation
- * on the JG address but on the computed node name added to the IPAddress instead.
- * This is to avoid any problem in the cluster as some nodes may interpret a node name
- * differently (IP resolution, name case, FQDN or host name, etc.)
- *
- * @see org.jboss.ha.framework.server.ClusterPartitionMBean
- *
- * @author  <a href="mailto:sacha.labourey at jboss.org">Sacha Labourey</a>.
- * @author Brian Stansberry
- * @author Vladimir Blagojevic
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- * @version $Revision$
- */
-
-public class ClusterNodeImpl
-   implements ClusterNode
-{
-   // Constants -----------------------------------------------------
-   
-   /** The serialVersionUID */
-   private static final long serialVersionUID = -1831036833785680731L;
-   
-   // Attributes ----------------------------------------------------
-  
-   private final String id;
-   private final Address jgAddress;
-   private final AddressPort address;
-
-   // Static --------------------------------------------------------
-   
-   // Constructors --------------------------------------------------
-       
-   ClusterNodeImpl(String id, Address jgAddress, AddressPort addressPort)
-   {
-      if (id == null)
-      {
-         throw new IllegalArgumentException("Null id");
-      }
-      if (addressPort == null)
-      {
-         throw new IllegalArgumentException("Null addressPort");
-      }
-      this.id = id;
-      this.address = addressPort;
-      
-      this.jgAddress = jgAddress;
-      
-   }
-  
-   // Public --------------------------------------------------------
-
-   public String getName()
-   {
-      return this.id;
-   }
-   
-   public InetAddress getIpAddress()
-   {
-      return this.address.getInetAddress();
-   }
-   
-   public int getPort()
-   {
-      return this.address.getPort();      
-   }
-
-   // Package protected ----------------------------------------------
-
-   Address getOriginalJGAddress()
-   {
-      return this.jgAddress;
-   }
-   
-   // Comparable implementation ----------------------------------------------
-
-   public int compareTo(ClusterNode o)
-   {
-      if (o == null)
-         throw new ClassCastException("Comparison to null value");
-      
-      if (!(o instanceof ClusterNodeImpl))
-         throw new ClassCastException("Comparison between different classes");
-
-      return this.id.compareTo(o.getName());
-   }
-   
-   // java.lang.Object overrides ---------------------------------------------------
-
-   public boolean equals(Object obj)
-   {
-      if (obj == null || !(obj instanceof ClusterNodeImpl)) return false;
-      
-      ClusterNodeImpl other = (ClusterNodeImpl) obj;
-      return this.id.equals(other.id);
-   }
-
-   public int hashCode()
-   {
-      return id.hashCode();
-   }
-
-   public String toString()
-   {
-      return this.getName();
-   }
-
-   // Package protected ---------------------------------------------
-   
-   // Protected -----------------------------------------------------
-
-
-   // Private -------------------------------------------------------
-   
-   /**
-    * Tries to determine the hostname of the given InetAddress without 
-    * triggering a reverse DNS lookup.  Tries to parse a symbolic hostname 
-    * from {@link InetAddress.toString()}, which is documented to return a 
-    * String of the form "symbolicname/ipaddress" with 'symbolicname' blank 
-    * if not stored in the object.
-    * <p/>
-    * If the symbolic name cannot be determined from InetAddress.toString(),
-    * the value of {@link InetAddress.getHostAddress()} is returned.
-    */
-   private static String getFastHostName(InetAddress address)
-   {
-      String result = null;
-      
-      String hostAddress = address.getHostAddress();
-      
-      String inetAddr = address.toString();
-      int idx = inetAddr.lastIndexOf('/');
-      int idx1 = inetAddr.indexOf(hostAddress);
-      if (idx1 == idx + 1)
-      {
-         if (idx == 0)
-            result = hostAddress;
-         else
-            result = inetAddr.substring(0, idx);
-      }
-      else
-      {
-         // Doesn't follow the toString() contract!
-         result = hostAddress;
-      }
-      return result;
-   }
-   
-   // Inner classes -------------------------------------------------
-   
-}

Modified: trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartition.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartition.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -21,35 +21,10 @@
  */
 package org.jboss.ha.framework.server;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.lang.ref.WeakReference;
-import java.security.AccessController;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.RunnableFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.AbstractQueuedSynchronizer;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -58,23 +33,20 @@
 import javax.naming.Reference;
 import javax.naming.StringRefAddr;
 
-import org.jboss.bootstrap.spi.as.config.JBossASBasedConfigurationInitializer;
-import org.jboss.ha.framework.interfaces.ClusterNode;
-import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
-import org.jboss.ha.framework.interfaces.GroupCommunicationService;
-import org.jboss.ha.framework.interfaces.GroupMembershipListener;
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.ha.framework.interfaces.ResponseFilter;
-import org.jboss.ha.framework.interfaces.StateTransferProvider;
+import org.jboss.beans.metadata.api.annotations.Create;
+import org.jboss.beans.metadata.api.annotations.Destroy;
+import org.jboss.beans.metadata.api.annotations.Start;
+import org.jboss.beans.metadata.api.annotations.Stop;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.ha.core.framework.server.DistributedReplicantManagerImpl;
+import org.jboss.ha.core.framework.server.HAPartitionImpl;
 import org.jboss.ha.framework.server.deployers.DefaultHAPartitionDependencyCreator;
 import org.jboss.ha.framework.server.deployers.HAPartitionDependencyCreator;
 import org.jboss.ha.framework.server.spi.HAPartitionCacheHandler;
-import org.jboss.ha.framework.server.spi.ManagedDistributedState;
-import org.jboss.invocation.MarshalledValueInputStream;
-import org.jboss.invocation.MarshalledValueOutputStream;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.logging.Logger;
+import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
 import org.jboss.managed.api.ManagedOperation.Impact;
 import org.jboss.managed.api.annotation.ManagementComponent;
 import org.jboss.managed.api.annotation.ManagementObject;
@@ -85,33 +57,9 @@
 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.loading.ContextClassLoaderSwitcher;
-import org.jboss.util.loading.ContextClassLoaderSwitcher.SwitchContext;
-import org.jgroups.Address;
-import org.jgroups.Channel;
-import org.jgroups.Event;
-import org.jgroups.ExtendedMembershipListener;
-import org.jgroups.ExtendedMessageListener;
-import org.jgroups.MembershipListener;
-import org.jgroups.MergeView;
-import org.jgroups.Message;
-import org.jgroups.MessageListener;
-import org.jgroups.Version;
-import org.jgroups.View;
-import org.jgroups.blocks.GroupRequest;
-import org.jgroups.blocks.MethodCall;
-import org.jgroups.blocks.RequestOptions;
-import org.jgroups.blocks.RpcDispatcher;
-import org.jgroups.stack.IpAddress;
-import org.jgroups.util.Rsp;
-import org.jgroups.util.RspList;
-import org.jgroups.util.UUID;
 
 /**
- * {@link HAPartition} implementation based on a
- * <a href="http://www.jgroups.com/">JGroups</a> <code>RpcDispatcher</code>
- * and a multiplexed <code>JChannel</code>.
+ * Extends the superclass to expose a ManagedObject interface.
  *
  * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
  * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>.
@@ -126,178 +74,23 @@
                   classProperties={@ManagementProperty(name="stateString",use={ViewUse.STATISTIC})},
                   isRuntime=true)
 public class ClusterPartition
-   extends ServiceMBeanSupport
-   implements ClusterNodeFactory, ExtendedMembershipListener, HAPartition,
-              AsynchEventHandler.AsynchEventProcessor,
-              ClusterPartitionMBean
+   extends HAPartitionImpl
+   implements ClusterPartitionMBean, KernelControllerContextAware
 {
-   public static final String DEFAULT_CACHE_CONFIG = "ha-partition";
-   
-   private static final byte EOF_VALUE   = -1;
-   private static final byte NULL_VALUE   = 0;
-   private static final byte SERIALIZABLE_VALUE = 1;
-   // TODO add Streamable support
-   // private static final byte STREAMABLE_VALUE = 2;
-   
-   /**
-    * Returned when an RPC call arrives for a service that isn't registered.
-    */
-   public static class NoHandlerForRPC implements Serializable
-   {
-      static final long serialVersionUID = -1263095408483622838L;
-   }
-   
-   private static class StateStreamEnd implements Serializable
-   {
-      /** The serialVersionUID */
-      private static final long serialVersionUID = -3705345735451504946L;
-   }
-   
-   /**
-    * Used internally when an RPC call requires a custom classloader for unmarshalling
-    */
-   private static class HAServiceResponse implements Serializable
-   {
-      private static final long serialVersionUID = -6485594652749906437L;
-      private final String serviceName;
-      private final byte[] payload;
-           
-      public HAServiceResponse(String serviceName, byte[] payload)
-      {
-         this.serviceName = serviceName;
-         this.payload = payload;
-      }
-           
-      public String getServiceName()
-      {
-         return this.serviceName;
-      }
-           
-      public byte[] getPayload()
-      {
-         return this.payload;
-      }
-   }
-   
-   /**
-    * Used to connect the channel asynchronously from the thread that calls start().
-    */
-   private class ChannelConnectTask implements Runnable
-   {
-      private final CountDownLatch latch;
-      
-      private ChannelConnectTask(CountDownLatch latch)
-      {
-         this.latch = latch;
-      }
-      
-      public void run()
-      {
-         try
-         {
-            ClusterPartition.this.channel.connect(ClusterPartition.this.getPartitionName());
-         }
-         catch (Exception e)
-         {
-            synchronized (ClusterPartition.this.channelLock)
-            {
-               ClusterPartition.this.connectException = e;
-            }
-         }
-         finally
-         {
-            this.latch.countDown();
-         }
-      }
-   }
 
    // Constants -----------------------------------------------------
 
-   // final MethodLookup method_lookup_clos = new MethodLookupClos();
-
    // Attributes ----------------------------------------------------
 
-   private   HAPartitionCacheHandler cacheHandler;
-   private   String cacheConfigName;
-   @SuppressWarnings("deprecation")
-   private   org.jgroups.ChannelFactory channelFactory;
-   private   String stackName;
-   private   String partitionName = JBossASBasedConfigurationInitializer.VALUE_PARTITION_NAME_DEFAULT;
-   private   long state_transfer_timeout=60000;
-   private   long method_call_timeout=60000;
-   
-   /** Thread pool used to asynchronously start our channel */
-   private Executor threadPool;
-   
-   private final Map<String, Object> rpcHandlers = new ConcurrentHashMap<String, Object>();
-   private final Map<String, StateTransferProvider> stateProviders = new HashMap<String, StateTransferProvider>();
-   @SuppressWarnings("deprecation")
-   private final Map<String, HAPartitionStateTransfer> initialStateRecipients = new HashMap<String, HAPartitionStateTransfer>();
-   /** Do we send any membership change notifications synchronously? */
-   private boolean allowSyncListeners = false;
-   /** The HAMembershipListener and HAMembershipExtendedListeners */
-   @SuppressWarnings("deprecation")
-   private final ArrayList<HAMembershipListener> synchListeners = new ArrayList<HAMembershipListener>();
-   /** The asynch HAMembershipListener and HAMembershipExtendedListeners */
-   @SuppressWarnings("deprecation")
-   private final ArrayList<HAMembershipListener> asynchListeners = new ArrayList<HAMembershipListener>();
-   /** The handler used to send membership change notifications asynchronously */
-   private AsynchEventHandler asynchHandler;
-   /** The current cluster partition members */
-   private Vector<ClusterNode> members = null;
-   private Vector<Address> jgmembers = null;
-   private final Map<String, WeakReference<ClassLoader>> clmap = new ConcurrentHashMap<String, WeakReference<ClassLoader>>();
-
-   private final Vector<String> history = new Vector<String>();
-
-   /** the local JG IP Address */
-   private Address localJGAddress = null;
-   /** me as a ClusterNode */
-   private ClusterNode me = null;
-   private ConcurrentMap<Address, IpAddress> addressMap = new ConcurrentHashMap<Address, IpAddress>();
-   /** The JGroups partition channel */
-   private Channel channel;
-   /** The cluster replicant manager */
-   private DistributedReplicantManagerImpl replicantManager;
-   /** The DistributedState service we manage */
-   @SuppressWarnings("deprecation")
-   private org.jboss.ha.framework.interfaces.DistributedState distributedState;
-   /** The cluster instance log category */
-   private Logger log = Logger.getLogger(HAPartition.class.getName());;
-   private Logger clusterLifeCycleLog = Logger.getLogger(HAPartition.class.getName() + ".lifecycle");
-   /** The current cluster view id */
-   private long currentViewId = -1;
    /** Whether to bind the partition into JNDI */
    private boolean bindIntoJndi = true;
    
-   private final ThreadGate flushBlockGate = new ThreadGate();
-   
-   private RpcDispatcher dispatcher = null;
-
-   /**
-    * True if serviceState was initialized during start-up.
-    */
-   protected boolean isStateSet = false;
-
-   /**
-    * An exception occurring upon fetch serviceState.
-    */
-   private Exception setStateException;
-   /**
-    * An exception occurring during channel connect
-    */
-   private Exception connectException;
-   private final Object channelLock = new Object();
-   private final MessageListenerAdapter messageListener = new MessageListenerAdapter();
-   
    private HAPartitionDependencyCreator  haPartitionDependencyCreator;
    private KernelControllerContext kernelControllerContext;
    
-   private final Map<String, StateTransferTask> stateTransferTasks = new Hashtable<String, StateTransferTask>();
+   // Legacy config properties, just to support management interface
+   private HAPartitionCacheHandler cacheHandler;
    
-   @SuppressWarnings("unchecked")
-   private final ContextClassLoaderSwitcher classLoaderSwitcher = (ContextClassLoaderSwitcher) AccessController.doPrivileged(ContextClassLoaderSwitcher.INSTANTIATOR);
-
    // Static --------------------------------------------------------
 
     // Constructors --------------------------------------------------
@@ -307,190 +100,38 @@
       this.logHistory("Partition object created");
    }
 
-   // ------------------------------------------------------------ ServiceMBean
-   
    // ----------------------------------------------------------------- Service
    
    protected void createService() throws Exception
    {
-      if (this.replicantManager == null)
-      {
-         this.replicantManager = new DistributedReplicantManagerImpl(this);
-      }
+      super.createService();    
 
-//      registerDRM();
-      
-      this.setupLoggers(this.getPartitionName());
-      
-      this.replicantManager.createService();
-      
-      if (this.distributedState instanceof ManagedDistributedState)
-      {
-         ((ManagedDistributedState) this.distributedState).createService();
-      }
-      
-      // Create the asynchronous handler for view changes
-      this.asynchHandler = new AsynchEventHandler(this, "AsynchViewChangeHandler");      
-
       // Add a well-known MC alias that other beans can depend on
       addCanonicalAlias();
-      
-      this.log.debug("done initializing partition");
    }
    
    protected void startService() throws Exception
    {
-      this.logHistory ("Starting partition");
+      super.startService();
+         
+      // Register with the service locator
+      HAPartitionLocator.getHAPartitionLocator().registerHAPartition(this);
       
-      // Have the handler get the cache
-      if (this.cacheHandler != null)
+      // Bind ourself in the public JNDI space if configured to do so
+      if (this.bindIntoJndi)
       {
-         this.cacheHandler.acquireCache();
-         this.channelFactory = this.cacheHandler.getCacheChannelFactory();
-         this.stackName = this.cacheHandler.getChannelStackName();
+         Context ctx = new InitialContext();
+         this.bind(HAPartitionLocator.getStandardJndiBinding(this.getPartitionName()),
+                   this, ClusterPartition.class, ctx);
+         this.log.debug("Bound in JNDI under /HAPartition/" + this.getPartitionName());
       }
       
-      if (this.channel == null || !this.channel.isOpen())
-      {
-         this.log.debug("Creating Channel for partition " + this.getPartitionName() +
-               " using stack " + this.getChannelStackName());
-   
-         this.channel = this.createChannel();               
-      }
-      
-      this.log.info("Initializing partition " + this.getPartitionName());
-      this.logHistory ("Initializing partition " + this.getPartitionName());
-      
-      this.dispatcher = new RpcHandler(this.channel, null, null, new Object(), false);
-      
-      // Subscribe to events generated by the channel
-      this.dispatcher.setMembershipListener(this);
-      this.dispatcher.setMessageListener(this.messageListener);
-      this.dispatcher.setRequestMarshaller(new RequestMarshallerImpl());
-      this.dispatcher.setResponseMarshaller(new ResponseMarshallerImpl());
-      
-      // Clear any old connectException
-      this.connectException = null;
-      CountDownLatch connectLatch = new CountDownLatch(1);
-      
-      if (this.threadPool == null)
-      {
-         this.channel.connect(this.getPartitionName());
-         connectLatch.countDown();
-      }
-      else
-      {
-         // Do the channel connect in another thread while this
-         // thread starts the cache and does that channel connect
-         ChannelConnectTask task = new ChannelConnectTask(connectLatch);
-         this.threadPool.execute(task);
-      }
-      
-      if (this.cacheHandler != null)
-      {
-         this.cacheHandler.startCache();
-      }
-      
-      try
-      {
-         // This will block waiting for any async channel connect above
-         connectLatch.await();
-         
-         if (this.connectException != null)
-         {
-            throw this.connectException;
-         }
-         
-         this.log.debug("Get current members");
-         this.waitForView();
-         
-         // get current JG group properties
-         this.localJGAddress = this.channel.getAddress();
-         this.me = getClusterNode(localJGAddress);         
-
-		 this.verifyNodeIsUnique();
-
-         this.fetchState();
-         
-         this.replicantManager.startService();
-         
-         if (this.distributedState instanceof ManagedDistributedState)
-         {
-            ((ManagedDistributedState) this.distributedState).startService();
-         }
-         
-         // Start the asynch listener handler thread
-         this.asynchHandler.start();
-         
-         // Register with the service locator
-         HAPartitionLocator.getHAPartitionLocator().registerHAPartition(this);
-         
-         // Bind ourself in the public JNDI space if configured to do so
-         if (this.bindIntoJndi)
-         {
-            Context ctx = new InitialContext();
-            this.bind(HAPartitionLocator.getStandardJndiBinding(this.getPartitionName()),
-                      this, ClusterPartition.class, ctx);
-            this.log.debug("Bound in JNDI under /HAPartition/" + this.getPartitionName());
-         }
-      }
-      catch (Throwable t)
-      {
-         this.log.debug("Caught exception after channel connected; closing channel -- " + t.getLocalizedMessage());
-         this.channel.close();
-         this.channel = null;
-         throw (t instanceof Exception) ? (Exception) t : new RuntimeException(t);
-      }
-      
    }
 
    protected void stopService() throws Exception
    {
-      this.logHistory ("Stopping partition");
-      this.log.info("Stopping partition " + this.getPartitionName());
-
-      try
-      {
-         this.asynchHandler.stop();
-      }
-      catch( Exception e)
-      {
-         this.log.warn("Failed to stop asynchHandler", e);
-      }
+      super.stopService();
       
-      if (this.distributedState instanceof ManagedDistributedState)
-      {
-         ((ManagedDistributedState) this.distributedState).stopService();
-      }
-
-      this.replicantManager.stopService();
-      
-      if (this.cacheHandler != null)
-      {
-         try
-         {
-            this.cacheHandler.releaseCache();
-         }
-         catch (Exception e)
-         {
-            this.log.error("cache release failed", e);
-         }
-      }
-      
-//    NR 200505 : [JBCLUSTER-38] replace channel.close() by a disconnect and
-//    add the destroyPartition() step
-      try
-      {
-         if (this.channel != null && this.channel.isConnected())
-         {
-            this.channel.disconnect();
-         }
-      }
-      catch (Exception e)
-      {
-         this.log.error("channel disconnection failed", e);
-      }
-
       if (this.bindIntoJndi)
       {
          String boundName = HAPartitionLocator.getStandardJndiBinding(this.getPartitionName());
@@ -515,61 +156,15 @@
       }
       
       HAPartitionLocator.getHAPartitionLocator().deregisterHAPartition(this);
-
-      this.log.info("Partition " + this.getPartitionName() + " stopped.");
    }
    
-   protected void destroyService()  throws Exception
-   {
-      this.log.debug("Destroying HAPartition: " + this.getPartitionName());
-      
+   @Override
+   protected void destroyService()
+   {      
       removeCanonicalAlias();
       
-      if (this.distributedState instanceof ManagedDistributedState)
-      {
-         ((ManagedDistributedState) this.distributedState).destroyService();
-      }
-
-      this.replicantManager.destroyService();
-      
-//      unregisterDRM();
-
-      try
-      {
-         if (this.channel != null && this.channel.isOpen())
-         {
-            this.channel.close();
-         }
-      }
-      catch (Exception e)
-      {
-         this.log.error("Closing channel failed", e);
-      }
-
-      this.log.info("Partition " + this.getPartitionName() + " destroyed.");
+      super.destroyService();
    }
-   
-   public ClusterNode getClusterNode(Address a)
-   {
-      IpAddress result = addressMap.get(a);
-      if (result == null)
-      {
-         result = (IpAddress) channel.downcall(new Event(Event.GET_PHYSICAL_ADDRESS, a));
-         if (result == null)
-         {
-            throw new IllegalStateException("Address " + a + "not registered in transport layer");
-         }
-         addressMap.put(a, result);
-      }
-      AddressPort addrPort = new AddressPort(result.getIpAddress(), result.getPort());
-      // FIXME -- when JGroups exposes UUID.get() via Channel, use that
-      String id = UUID.get(a);
-      if (id == null)
-      {
-         id = addrPort.getHostAddress() + ":" + addrPort.getPort();
-      }
-      return new ClusterNodeImpl(id, a, addrPort);
-   }
 
    /**
     * Adds an alias to our controller context -- the concatenation of
@@ -583,7 +178,7 @@
       if (kernelControllerContext != null)
       {
          KernelController kc = (KernelController) kernelControllerContext.getController();
-         String aliasName = getHaPartitionDependencyCreator().getHAPartitionDependencyName(this.partitionName);
+         String aliasName = getHaPartitionDependencyCreator().getHAPartitionDependencyName(this.getPartitionName());
          try
          {
             kc.addAlias(aliasName, kernelControllerContext.getName());
@@ -603,7 +198,7 @@
       if (kernelControllerContext != null)
       {
          KernelController kc = (KernelController) kernelControllerContext.getController();
-         String aliasName = getHaPartitionDependencyCreator().getHAPartitionDependencyName(this.partitionName);
+         String aliasName = getHaPartitionDependencyCreator().getHAPartitionDependencyName(this.getPartitionName());
          Set<Object> aliases = kernelControllerContext.getAliases();
          if (aliases != null && aliases.contains(aliasName))
          {
@@ -618,1088 +213,56 @@
          }
       }
    }
-   
-   // ---------------------------------------------------------- State Transfer
 
-
-   protected void fetchState() throws Exception
-   {
-      this.log.info("Fetching serviceState (will wait for " + this.getStateTransferTimeout() +
-            " milliseconds):");
-      boolean intr = false;
-      try
-      {
-         long start, stop;
-         this.isStateSet = false;
-         start = System.currentTimeMillis();
-         boolean rc = this.channel.getState(null, this.getStateTransferTimeout());
-         if (rc)
-         {
-            synchronized (this.channelLock)
-            {
-               while (!this.isStateSet)
-               {
-                  if (this.setStateException != null)
-                  {
-                     throw this.setStateException;
-                  }
-
-                  try
-                  {
-                     this.channelLock.wait();
-                  }
-                  catch (InterruptedException iex)
-                  {
-                     intr = true;
-                  }
-               }
-            }
-            stop = System.currentTimeMillis();
-            this.log.info("serviceState was retrieved successfully (in " + (stop - start) + " milliseconds)");
-         }
-         else
-         {
-            // No one provided us with serviceState.
-            // We need to find out if we are the coordinator, so we must
-            // block until viewAccepted() is called at least once
-
-            synchronized (this.members)
-            {
-               while (this.members.size() == 0)
-               {
-                  this.log.debug("waiting on viewAccepted()");
-                  try
-                  {
-                     this.members.wait();
-                  }
-                  catch (InterruptedException iex)
-                  {
-                     intr = true;
-                  }
-               }
-            }
-
-            if (this.isCurrentNodeCoordinator())
-            {
-               this.log.info("State could not be retrieved (we are the first member in group)");
-            }
-            else
-            {
-               throw new IllegalStateException("Initial serviceState transfer failed: " +
-                  "Channel.getState() returned false");
-            }
-         }
-      }
-      finally
-      {
-         if (intr) Thread.currentThread().interrupt();
-      }
-   }
-
-   @SuppressWarnings("deprecation")
-   private void getStateInternal(OutputStream stream) throws IOException
-   {
-      MarshalledValueOutputStream mvos = null; // don't create until we know we need it
-      
-      for (Map.Entry<String, HAPartitionStateTransfer> entry: this.initialStateRecipients.entrySet())
-      {
-         HAPartitionStateTransfer subscriber = entry.getValue();
-         this.log.debug("getState for " + entry.getKey());
-         Serializable state = subscriber.getCurrentState();
-         if (state != null)
-         {
-            if (mvos == null)
-            {
-               // This is our first write, so need to write the header first
-               stream.write(SERIALIZABLE_VALUE);
-               
-               mvos = new MarshalledValueOutputStream(stream);
-            }
-            
-            mvos.writeObject(entry.getKey());
-            mvos.writeObject(state);
-         }
-      }
-      
-      if (mvos == null)
-      {
-         // We never wrote any serviceState, so write the NULL header
-         stream.write(NULL_VALUE);
-      }
-      else
-      {
-         mvos.writeObject(new StateStreamEnd());
-         mvos.flush();
-         mvos.close();
-      }
-      
-   }
-   
-   @SuppressWarnings("deprecation")
-   private void setStateInternal(InputStream stream) throws IOException, ClassNotFoundException
-   {
-      byte type = (byte) stream.read();
-      
-      if (type == EOF_VALUE)
-      {
-         this.log.debug("serviceState stream is empty");
-         return;
-      }
-      else if (type == NULL_VALUE)
-      {
-         this.log.debug("serviceState is null");
-         return;
-      }
-      
-      long used_mem_before, used_mem_after;
-      Runtime rt=Runtime.getRuntime();
-      used_mem_before=rt.totalMemory() - rt.freeMemory();
-      
-      MarshalledValueInputStream mvis = new MarshalledValueInputStream(stream);
-      
-      while (true)
-      {
-         Object obj = mvis.readObject();
-         if (obj instanceof StateStreamEnd)
-         {
-            break;
-         }
-         
-         String key = (String) obj;
-         this.log.debug("setState for " + key);
-         Object someState = mvis.readObject();
-         HAPartitionStateTransfer subscriber = this.initialStateRecipients.get(key);
-         if (subscriber != null)
-         {
-            try
-            {
-               subscriber.setCurrentState((Serializable)someState);
-            }
-            catch (Exception e)
-            {
-               // Don't let issues with one subscriber affect others
-               // unless it is DRM, which is really an internal function
-               // of the HAPartition
-               // FIXME remove this once DRM is JBC-based
-               if (DistributedReplicantManagerImpl.SERVICE_NAME.equals(key))
-               {
-                  if (e instanceof RuntimeException)
-                  {
-                     throw (RuntimeException) e;
-                  }
-
-                  throw new RuntimeException(e);
-               }
-
-               this.log.error("Caught exception setting serviceState to " + subscriber, e);
-            }
-         }
-         else
-         {
-            this.log.debug("There is no stateHandler for: " + key);
-         }
-      }
-      
-      try
-      {
-         stream.close();
-      }
-      catch(Exception e)
-      {
-         this.log.error("Caught exception closing serviceState stream", e);
-      }
-
-      used_mem_after=rt.totalMemory() - rt.freeMemory();
-      this.log.debug("received serviceState; expanded memory by " +
-            (used_mem_after - used_mem_before) + " bytes (used memory before: " + used_mem_before +
-            ", used memory after: " + used_mem_after + ")");
-   }
-
-   private void recordSetStateFailure(Throwable t)
-   {
-      this.log.error("failed setting serviceState", t);
-      if (t instanceof Exception)
-      {
-         this.setStateException = (Exception) t;
-      }
-      else
-      {
-         this.setStateException = new Exception(t);
-      }
-   }
-
-   private void notifyChannelLock()
-   {
-      synchronized (this.channelLock)
-      {
-         this.channelLock.notifyAll();
-      }
-   }
-   
-   // org.jgroups.MembershipListener implementation ----------------------------------------------
-   
-   public void suspect(org.jgroups.Address suspected_mbr)
-   {
-      this.logHistory ("Node suspected: " + (suspected_mbr==null?"null":suspected_mbr.toString()));
-      if (this.isCurrentNodeCoordinator ())
-      {
-         this.clusterLifeCycleLog.info ("Suspected member: " + suspected_mbr);
-      }
-      else
-      {
-         this.log.info("Suspected member: " + suspected_mbr);
-      }
-   }
-
-   public void block()
-   {
-       this.flushBlockGate.close();
-       this.log.debug("Block processed at " + this.me);
-   }
-   
-   public void unblock()
-   {
-       this.flushBlockGate.open();
-       this.log.debug("Unblock processed at " + this.me);
-   }
-   
-   /** Notification of a cluster view change. This is done from the JG protocol
-    * handler thread and we must be careful to not unduly block this thread.
-    * Because of this there are two types of listeners, synchronous and
-    * asynchronous. The synchronous listeners are messaged with the view change
-    * event using the calling thread while the asynchronous listeners are
-    * messaged using a separate thread.
-    *
-    * @param newView
-    */
-   public void viewAccepted(View newView)
-   {
-      try
-      {
-         // we update the view id
-         this.currentViewId = newView.getVid().getId();
-
-         Vector<ClusterNode> translatedNewView = this.translateAddresses (cloneMembers(newView));
-         this.logHistory ("New view: " + translatedNewView + " with viewId: " + this.currentViewId +
-                     " (old view: " + this.members + " )");
-
-
-         // Save the previous view and make a copy of the new view
-         Vector<ClusterNode> oldMembers = this.members;
-
-         Vector<Address> newjgMembers = cloneMembers(newView);
-         Vector<ClusterNode> newMembers = this.translateAddresses(newjgMembers); // TRANSLATE
-         this.members = newMembers;
-         this.jgmembers = newjgMembers;
-         
-         if (oldMembers == null)
-         {
-            // Initial viewAccepted
-            this.log.debug("ViewAccepted: initial members set for partition " + this.getPartitionName() + ": " +
-                     this.currentViewId + " (" + this.members + ")");
-            
-            this.log.info("Number of cluster members: " + this.members.size());
-            for(int m = 0; m > this.members.size(); m ++)
-            {
-               Object node = this.members.get(m);
-               this.log.debug(node);
-            }
-            this.log.info ("Other members: " + (this.members.size() - 1));
-            
-            // Wake up the deployer thread blocking in waitForView
-            this.notifyChannelLock();
-            return;
-         }
-         
-         int difference = newMembers.size() - oldMembers.size();
-         
-         boolean merge = newView instanceof MergeView;
-         if (this.isCurrentNodeCoordinator ())
-         {
-            this.clusterLifeCycleLog.info ("New cluster view for partition " + this.getPartitionName() + " (id: " +
-                                      this.currentViewId + ", delta: " + difference + ", merge: " + merge + ") : " + this.members);
-         }
-         else
-         {
-            this.log.info("New cluster view for partition " + this.getPartitionName() + ": " +
-                     this.currentViewId + " (" + this.members + " delta: " + difference + ", merge: " + merge + ")");
-         }
-
-         // Build a ViewChangeEvent for the asynch listeners
-         ViewChangeEvent event = new ViewChangeEvent();
-         event.viewId = this.currentViewId;
-         event.allMembers = translatedNewView;
-         event.deadMembers = this.getDeadMembers(oldMembers, event.allMembers);
-         event.newMembers = this.getNewMembers(oldMembers, event.allMembers);
-         event.originatingGroups = null;
-         // if the new view occurs because of a merge, we first inform listeners of the merge
-         if(newView instanceof MergeView)
-         {
-            MergeView mergeView = (MergeView) newView;
-            Vector<View> subgroups = mergeView.getSubgroups();
-            event.originatingGroups = new Vector<List<ClusterNode>>(subgroups.size());
-            for (View view : subgroups)
-            {
-               event.originatingGroups.add(this.translateAddresses(view.getMembers()));
-            }
-         }
-
-         this.log.debug("membership changed from " + oldMembers.size() + " to " + event.allMembers.size());
-         // Put the view change to the asynch queue
-         this.asynchHandler.queueEvent(event);
-
-         // Broadcast the new view to the synchronous view change listeners
-         if (this.allowSyncListeners)
-         {
-            this.notifyListeners(this.synchListeners, event.viewId, event.allMembers,
-                  event.deadMembers, event.newMembers, event.originatingGroups);
-         }
-      }
-      catch (Exception ex)
-      {
-         this.log.error("ViewAccepted failed", ex);
-      }
-   }
-
-   private void waitForView() throws Exception
-   {
-      boolean intr = false;
-      try
-      {
-         synchronized (this.channelLock)
-         {
-            if (this.members == null)
-            {
-               if (this.connectException != null)
-               {
-                  throw this.connectException;
-               }
-
-               try
-               {
-                  this.channelLock.wait(this.getMethodCallTimeout());
-               }
-               catch (InterruptedException iex)
-               {
-                  intr = true;
-               }
-
-               if (this.connectException != null)
-               {
-                  throw this.connectException;
-               }
-
-               if (this.members == null)
-               {
-                  throw new IllegalStateException("No view received from Channel");
-               }
-            }
-         }
-      }
-      finally
-      {
-         if (intr) Thread.currentThread().interrupt();
-      }
-   }
-
    // HAPartition implementation ----------------------------------------------
    
-   public boolean isConsistentWith(GroupCommunicationService other)
-   {
-      return this == other;
-   }
-   
    @ManagementProperty(use={ViewUse.STATISTIC}, description="The identifier for this node in cluster topology views")
    public String getNodeName()
    {
-      return this.me == null ? null : this.me.getName();
+      return super.getNodeName();
    }
 
    @ManagementProperty(use={ViewUse.CONFIGURATION}, description="Deprecated, legacy term for group name")
    @ManagementObjectID(type="HAPartition")
    public String getGroupName()
    {
-      return this.partitionName;
+      return super.getGroupName();
    }
    
    @ManagementProperty(use={ViewUse.CONFIGURATION}, description="Deprecated, legacy term for group name")
    @ManagementObjectID(type="HAPartition")
    public String getPartitionName()
    {
-      return this.partitionName;
+      return super.getPartitionName();
    }
 
-   public void setPartitionName(String newName)
-   {
-      this.partitionName = newName;
-   }
-   
-   public DistributedReplicantManager getDistributedReplicantManager()
-   {
-      return this.replicantManager;
-   }
-   
-   @SuppressWarnings("deprecation")
-   public org.jboss.ha.framework.interfaces.DistributedState getDistributedStateService()
-   {
-      return this.distributedState;
-   }
-
    @ManagementProperty(use={ViewUse.STATISTIC}, description="Identifier for the current topology view")
    public long getCurrentViewId()
    {
-      return this.currentViewId;
+      return super.getCurrentViewId();
    }
    
    @ManagementProperty(use={ViewUse.STATISTIC}, description="The current cluster topology view")
    public Vector<String> getCurrentView()
    {
-      Vector<String> result = new Vector<String>(this.members.size());
-      for (ClusterNode member: this.members)
-      {
-         result.add(member.getName());
-      }
-      return result;
+      return super.getCurrentView();
    }
 
-   public ClusterNode[] getClusterNodes ()
-   {
-      synchronized (this.members)
-      {
-         return this.members.toArray(new ClusterNode[this.members.size()]);
-      }
-   }
-
-   public ClusterNode getClusterNode ()
-   {
-      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)
-      {
-         return false;
-      }
-     return this.members.elementAt (0).equals (this.me);
+      return super.isCurrentNodeCoordinator();
    }
-
-   // ***************************
-   // ***************************
-   // RPC multicast communication
-   // ***************************
-   // ***************************
    
-   /**
-    * {@inheritDoc}
-    */
-   public void registerRPCHandler(String objName, Object subscriber)
-   {
-      this.rpcHandlers.put(objName, subscriber);
-   }
-   
-   /**
-    * {@inheritDoc}
-    */
-   public void registerRPCHandler(String objName, Object subscriber, ClassLoader classloader)
-   {
-      this.registerRPCHandler(objName, subscriber);
-      this.clmap.put(objName, new WeakReference<ClassLoader>(classloader));
-   }
-   
-   /**
-    * {@inheritDoc}
-    */
-   public void unregisterRPCHandler(String objName, Object subscriber)
-   {
-      this.rpcHandlers.remove(objName);
-      this.clmap.remove(objName);
-   }
 
-   /**
-    * {@inheritDoc}
-    */
-   public ArrayList<?> callMethodOnCluster(String serviceName, String methodName,
-      Object[] args, Class<?>[] types, boolean excludeSelf) throws InterruptedException
-   {
-      return this.callMethodOnCluster(serviceName, methodName, args, types, Object.class, excludeSelf, null, this.getMethodCallTimeout(), false);
-   }
-   
-   /**
-    * {@inheritDoc}
-    */
-   public ArrayList<?> callMethodOnCluster(String serviceName, String methodName, 
-      Object[] args, Class<?>[] types, boolean excludeSelf, ResponseFilter filter) throws InterruptedException
-   {
-      return this.callMethodOnCluster(serviceName, methodName, args, types, Object.class, excludeSelf, filter, this.getMethodCallTimeout(), false);
-   }   
-
-   /**
-    * {@inheritDoc}
-    */
-   public <T> ArrayList<T> callMethodOnCluster(String serviceName, String methodName, Object[] args, Class<?>[] types,
-         Class<T> returnType, boolean excludeSelf, ResponseFilter filter, long methodTimeout, boolean unordered)
-         throws InterruptedException
-   {
-      MethodCall m = new MethodCall(serviceName + "." + methodName, args, types);
-      RspFilterAdapter rspFilter = filter == null ? null : new RspFilterAdapter(filter,this);
-      RequestOptions ro = new RequestOptions( GroupRequest.GET_ALL, methodTimeout, false, rspFilter);
-      if (excludeSelf)
-      {
-         ro.setExclusionList(this.localJGAddress);
-      }
-      
-      if(this.channel.flushSupported())
-      {
-         this.flushBlockGate.await(this.getStateTransferTimeout());
-      }
-      
-      boolean trace = this.log.isTraceEnabled();
-      if(trace)
-      {
-         this.log.trace("calling synchronous method on cluster, serviceName="+serviceName
-            +", methodName="+methodName+", members="+this.members+", excludeSelf="+excludeSelf);
-      }
-      RspList rsp = this.dispatcher.callRemoteMethods(null, m, ro);
-      return this.processResponseList(rsp, returnType, trace);
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public Object callMethodOnCoordinatorNode(String objName, String methodName,
-          Object[] args, Class<?>[] types,boolean excludeSelf) throws Exception
-   {
-      return this.callMethodOnCoordinatorNode(objName,methodName,args,types,Object.class,excludeSelf, this.getMethodCallTimeout(),false);
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public <T> T callMethodOnCoordinatorNode(String objName, String methodName,
-          Object[] args, Class<?>[] types, Class<T> returnType, boolean excludeSelf, long methodTimeout, boolean unordered) throws Exception
-   {
-      boolean trace = this.log.isTraceEnabled();
-
-      MethodCall m = new MethodCall(objName + "." + methodName, args, types);
-      
-      if( trace )
-      {
-         this.log.trace("callMethodOnCoordinatorNode(false), objName="+objName
-            +", methodName="+methodName);
-      }
-      
-      if (returnType == null)
-      {
-         // Use void.class as return type; a call to void.class.cast(object)
-         // below will throw CCE for anything other than null response
-         @SuppressWarnings("unchecked")
-         Class<T> unchecked = (Class<T>) void.class;
-         returnType = unchecked;
-      }
-
-      // the first cluster view member is the coordinator
-      // If we are the coordinator, only call ourself if 'excludeSelf' is false
-      if (this.isCurrentNodeCoordinator () && excludeSelf)
-      {
-         return null;
-      } 
-      
-      Address coord = this.jgmembers.elementAt(0);
-      RequestOptions opt = new RequestOptions( GroupRequest.GET_ALL, methodTimeout);
-      if (unordered)
-      {
-         opt.setFlags(Message.OOB);
-      }
-      try
-      {
-         return returnType.cast(this.dispatcher.callRemoteMethod(coord, m, opt));
-      }
-      catch (Exception e)
-      {
-         throw e;
-      }
-      catch (Error e)
-      {
-         throw e;
-      }
-      catch (Throwable e)
-      {
-         throw new RuntimeException("Caught raw Throwable on remote invocation", e);
-      }
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public Object callMethodOnNode(String serviceName, String methodName, Object[] args, Class<?>[] types,
-         ClusterNode targetNode) throws Exception
-   {
-      return this.callMethodOnNode(serviceName, methodName, args, types, Object.class, this.getMethodCallTimeout(), targetNode, false);
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public Object callMethodOnNode(String serviceName, String methodName,
-           Object[] args, Class<?>[] types, long methodTimeout, ClusterNode targetNode) throws Exception
-   {
-      return this.callMethodOnNode(serviceName, methodName, args, types, Object.class, methodTimeout, targetNode, false);
-   }   
-
-   /**
-    * {@inheritDoc}
-    */
-   public <T> T callMethodOnNode(String serviceName, String methodName, Object[] args, Class<?>[] types,
-         Class<T> returnType, long methodTimeout, ClusterNode targetNode, boolean unordered)
-         throws Exception
-   {
-      if (returnType == null)
-      {
-         // Use void.class as return type; a call to void.class.cast(object)
-         // below will throw CCE for anything other than null response
-         @SuppressWarnings("unchecked")
-         Class<T> unchecked = (Class<T>) void.class;
-         returnType = unchecked;
-      }
-      
-      if (!(targetNode instanceof ClusterNodeImpl))
-      {
-         throw new IllegalArgumentException("targetNode " + targetNode + " is not an instance of " +
-                                          ClusterNodeImpl.class + " -- only targetNodes provided by this HAPartition should be used");
-      }
-      boolean trace = this.log.isTraceEnabled();
-
-      MethodCall m = new MethodCall(serviceName + "." + methodName, args, types);
-
-      if (trace)
-      {
-         this.log.trace("callMethodOnNode( objName=" + serviceName + ", methodName=" + methodName);
-      }
-      Object rsp = null;
-      RequestOptions opt = new RequestOptions(GroupRequest.GET_FIRST, methodTimeout);
-      if (unordered)
-      {
-         opt.setFlags(Message.OOB);
-      }
-      try
-      {
-         rsp = this.dispatcher.callRemoteMethod(((ClusterNodeImpl) targetNode).getOriginalJGAddress(), m, opt);
-      }
-      catch (Exception e)
-      {
-         throw e;
-      }
-      catch (Error e)
-      {
-         throw e;
-      }
-      catch (Throwable e)
-      {
-         throw new RuntimeException("Caught raw Throwable on remote invocation", e);
-      }
-      
-      if (rsp instanceof NoHandlerForRPC)
-      {
-         this.log.trace("Ignoring NoHandlerForRPC");
-         rsp = null;
-      }
-
-      return returnType.cast(rsp);
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public void callAsyncMethodOnNode(String serviceName, String methodName, Object[] args, Class<?>[] types,
-         ClusterNode targetNode) throws Exception
-   {
-      this.callAsyncMethodOnNode(serviceName, methodName, args, types, targetNode, false);
-   }
-   
-   /**
-    * {@inheritDoc}
-    */
-   public void callAsyncMethodOnNode(String serviceName, String methodName, Object[] args, Class<?>[] types,
-         ClusterNode targetNode, boolean unordered) throws Exception
-   {
-
-      if (!(targetNode instanceof ClusterNodeImpl))
-      {
-         throw new IllegalArgumentException("targetNode " + targetNode + " is not an instance of " +
-                                         ClusterNodeImpl.class + " -- only targetNodes provided by this HAPartition should be used");
-      }
-      boolean trace = this.log.isTraceEnabled();
-
-      MethodCall m = new MethodCall(serviceName + "." + methodName, args, types);
-
-      if (trace)
-      {
-         this.log.trace("callAsyncMethodOnNode( objName=" + serviceName + ", methodName=" + methodName);
-      }
-      RequestOptions opt = new RequestOptions(GroupRequest.GET_NONE, this.getMethodCallTimeout());
-      if (unordered)
-      {
-         opt.setFlags(Message.OOB);
-      }
-      try
-      {
-         this.dispatcher.callRemoteMethod(((ClusterNodeImpl) targetNode).getOriginalJGAddress(), m, opt);
-      }
-      catch (Exception e)
-      {
-         throw e;
-      }
-      catch (Error e)
-      {
-         throw e;
-      }
-      catch (Throwable e)
-      {
-         throw new RuntimeException("Caught raw Throwable on remote invocation", e);
-      }
-   }
-
-   private <T> ArrayList<T> processResponseList(RspList rspList, Class<T> returnType, boolean trace)
-   {
-      if (returnType == null)
-      {
-         // Use void.class as return type; a call to void.class.cast(object)
-         // below will throw CCE for anything other than null response
-         @SuppressWarnings("unchecked")
-         Class<T> unchecked = (Class<T>) void.class;
-         returnType = unchecked;
-      }
-      
-      ArrayList<T> rtn = new ArrayList<T>();
-      if (rspList != null)
-      {
-         for (Rsp<?> response : rspList.values())
-         {
-            // Only include received responses
-            if(response.wasReceived())
-            {
-               Object item = response.getValue();
-               if (item instanceof NoHandlerForRPC)
-               {
-                  continue;
-               }
-               else
-               {
-                  rtn.add(returnType.cast(item));
-               }
-            }
-            else if( trace )
-            {
-               this.log.trace("Ignoring non-received response: "+response);
-            }
-         }
-         
-      }
-      return rtn;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public void callAsynchMethodOnCluster(String serviceName, String methodName,
-      Object[] args, Class<?>[] types, boolean excludeSelf) throws InterruptedException
-   {
-      this.callAsynchMethodOnCluster(serviceName, methodName, args, types, excludeSelf, false);
-   }
-   
-   /**
-    * {@inheritDoc}
-    */
-   public void callAsynchMethodOnCluster(String serviceName, String methodName, Object[] args, Class<?>[] types,
-         boolean excludeSelf, boolean unordered) throws InterruptedException
-   {
-      MethodCall m = new MethodCall(serviceName + "." + methodName, args, types);
-      RequestOptions ro = new RequestOptions( GroupRequest.GET_NONE, this.getMethodCallTimeout());
-      if (excludeSelf)
-      {         
-         ro.setExclusionList(this.localJGAddress);
-      }
-      
-      if(this.channel.flushSupported())
-      {
-         this.flushBlockGate.await(this.getStateTransferTimeout());
-      }
-      if(this.log.isTraceEnabled())
-      {
-         this.log.trace("calling asynch method on cluster, serviceName="+serviceName
-            +", methodName="+methodName+", members="+this.members+", excludeSelf="+excludeSelf);
-      }
-      this.dispatcher.callRemoteMethods(null, m, ro);
-
-   }
-
-   public void callAsyncMethodOnCoordinatorNode(String serviceName, String methodName, Object[] args, Class<?>[] types,
-         boolean excludeSelf) throws Exception
-   {
-      this.callAsyncMethodOnCoordinatorNode(serviceName, methodName, args, types, excludeSelf, false);
-   }
-
-   public void callAsyncMethodOnCoordinatorNode(String serviceName, String methodName, Object[] args,
-         Class<?>[] types, boolean excludeSelf, boolean unordered) throws Exception
-   {
-
-      boolean trace = this.log.isTraceEnabled();
-
-      MethodCall m = new MethodCall(serviceName + "." + methodName, args, types);
-      
-      if( trace )
-      {
-         this.log.trace("callMethodOnCoordinatorNode(false), objName=" + serviceName
-            +", methodName="+methodName);
-      }
-
-      // the first cluster view member is the coordinator
-      // If we are the coordinator, only call ourself if 'excludeSelf' is false
-      if (this.isCurrentNodeCoordinator () && excludeSelf)
-      {
-         return;
-      } 
-      
-      Address coord = this.jgmembers.elementAt(0);
-      RequestOptions opt = new RequestOptions( GroupRequest.GET_ALL, this.getMethodCallTimeout());
-      if (unordered)
-      {
-         opt.setFlags(Message.OOB);
-      }
-      try
-      {
-         this.dispatcher.callRemoteMethod(coord, m, opt);
-      }
-      catch (Exception e)
-      {
-         throw e;
-      }
-      catch (Error e)
-      {
-         throw e;
-      }
-      catch (Throwable e)
-      {
-         throw new RuntimeException("Caught raw Throwable on remote invocation", e);
-      }
-   }
-   
-   // *************************
-   // *************************
-   // State transfer management
-   // *************************
-   // *************************
-   
-   public Future<Serializable> getServiceState(String serviceName, ClassLoader classloader)
-   {
-      RunnableFuture<Serializable> future = null;
-      StateTransferTask task = stateTransferTasks.get(serviceName);
-      if (task == null)
-      {
-         task = new StateTransferTask(serviceName, classloader);
-         stateTransferTasks.put(serviceName, task);
-         future = new FutureTask<Serializable>(task);
-         Executor e = threadPool == null ? Executors.newSingleThreadExecutor() : threadPool;
-         e.execute(future);
-      }
-      else
-      {
-         // Unlikely scenario
-         future = new FutureTask<Serializable>(task);
-      }
-      return future;
-   }
-
-   public Future<Serializable> getServiceState(String serviceName)
-   {
-      return getServiceState(serviceName, null);
-   }
-
-   public void registerStateTransferProvider(String serviceName, StateTransferProvider provider)
-   {
-      this.stateProviders.put(serviceName, provider);
-   }
-
-   public void unregisterStateTransferProvider(String serviceName)
-   {
-      this.stateProviders.remove(serviceName);
-   }
-   
-   @SuppressWarnings("deprecation")
-   public void subscribeToStateTransferEvents(String serviceName, HAPartitionStateTransfer subscriber)
-   {
-      this.initialStateRecipients.put(serviceName, subscriber);
-   }
-
-   @SuppressWarnings("deprecation")
-   public void unsubscribeFromStateTransferEvents(String serviceName, HAPartitionStateTransfer subscriber)
-   {
-      this.initialStateRecipients.remove(serviceName);
-   }
-   
-   // *************************
-   // *************************
-   // Group Membership listeners
-   // *************************
-   // *************************
-   
-  
-   public void registerGroupMembershipListener(GroupMembershipListener listener)
-   {
-      synchronized(this.asynchListeners) {
-         this.asynchListeners.add(new GroupMembershipListenerAdapter(listener));
-      }
-   }
-
-   public void unregisterGroupMembershipListener(GroupMembershipListener listener)
-   {
-      synchronized(this.asynchListeners) {
-         this.asynchListeners.remove(new GroupMembershipListenerAdapter(listener));
-      }
-   }
-   
-   @SuppressWarnings("deprecation")
-   public void registerMembershipListener(HAMembershipListener listener)
-   {
-      boolean isAsynch = (this.allowSyncListeners == false)
-            || (listener instanceof AsynchHAMembershipListener)
-            || (listener instanceof AsynchHAMembershipExtendedListener);
-      if( isAsynch ) {
-         synchronized(this.asynchListeners) {
-            this.asynchListeners.add(listener);
-         }
-      }
-      else  {
-         synchronized(this.synchListeners) {
-            this.synchListeners.add(listener);
-         }
-      }
-   }
-
-   @SuppressWarnings("deprecation")
-   public void unregisterMembershipListener(HAMembershipListener listener)
-   {
-      boolean isAsynch = (this.allowSyncListeners == false)
-            || (listener instanceof AsynchHAMembershipListener)
-            || (listener instanceof AsynchHAMembershipExtendedListener);
-      if( isAsynch ) {
-         synchronized(this.asynchListeners) {
-            this.asynchListeners.remove(listener);
-         }
-      }
-      else  {
-         synchronized(this.synchListeners) {
-            this.synchListeners.remove(listener);
-         }
-      }
-   }
-   
    @ManagementProperty(use={ViewUse.CONFIGURATION, ViewUse.RUNTIME}, 
          description="Whether to allow synchronous notifications of topology changes")
    public boolean getAllowSynchronousMembershipNotifications()
    {
-      return this.allowSyncListeners;
+      return super.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)
-   {
-      this.allowSyncListeners = allowSync;
-   }
-   
-   // AsynchEventHandler.AsynchEventProcessor -----------------------
-
-   public void processEvent(Object event)
-   {
-      ViewChangeEvent vce = (ViewChangeEvent) event;
-      this.notifyListeners(this.asynchListeners, vce.viewId, vce.allMembers,
-            vce.deadMembers, vce.newMembers, vce.originatingGroups);
-      
-   }
-   
-   
-   // Public ------------------------------------------------------------------
-   
-   @SuppressWarnings("deprecation")
-   public void setDistributedStateImpl(org.jboss.ha.framework.interfaces.DistributedState distributedState)
-   {
-      this.distributedState = distributedState;
-   }   
-   
-   // Protected -----------------------------------------------------
-   
-   @SuppressWarnings("deprecation")
-   protected Channel createChannel()
-   {
-      org.jgroups.ChannelFactory factory = this.getChannelFactory();
-      if (factory == null)
-      {
-         throw new IllegalStateException("HAPartitionConfig has no JChannelFactory");
-      }
-      String stack = this.getChannelStackName();
-      if (stack == null)
-      {
-         throw new IllegalStateException("HAPartitionConfig has no multiplexer stack");
-      }
-      try
-      {
-         return factory.createMultiplexerChannel(stack, this.getPartitionName());
-      }
-      catch (RuntimeException e)
-      {
-         throw e;
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Failure creating multiplexed Channel", e);
-      }
-   }
-
-   protected void verifyNodeIsUnique () throws IllegalStateException
-   {
-      ClusterNodeImpl matched = null;
-      for (ClusterNode member : this.getClusterNodes())
-      {
-         if (member.equals(this.me))
-         {
-            if (matched == null)
-            {
-               // We of course are in the view, so we expect one match
-               // Just track that we've had one
-               matched = (ClusterNodeImpl) member;
-            }
-            else
-            {
-               // Two nodes in view match us; try to figure out which one isn't us
-               ClusterNodeImpl other = matched;
-               if (other.getOriginalJGAddress().equals(((ClusterNodeImpl)this.me).getOriginalJGAddress()))
-               {
-                  other = (ClusterNodeImpl) member;
-               }
-               throw new IllegalStateException("Found member " + other +
-                     " in current view that duplicates us (" + this.me + "). This" +
-                     " node cannot join partition until duplicate member has" +
-                     " been removed");
-            }
-         }
-      }
-   }
-
-   /**
     * Helper method that binds the partition in the JNDI tree.
     * @param jndiName Name under which the object must be bound
     * @param who Object to bind in JNDI
@@ -1736,88 +299,6 @@
       ctx.rebind (n.get (0), ref);
    }
    
-   /**
-    * Helper method that returns a vector of dead members from two input vectors: new and old vectors of two views.
-    * Dead members are old - new members.
-    * @param oldMembers Vector of old members
-    * @param newMembers Vector of new members
-    * @return Vector of members that have died between the two views, can be empty.
-    */
-   protected Vector<ClusterNode> getDeadMembers(Vector<ClusterNode> oldMembers, Vector<ClusterNode> newMembers)
-   {
-      if(oldMembers == null)
-      {
-         oldMembers=new Vector<ClusterNode>();
-      }
-      if(newMembers == null)
-      {
-         newMembers=new Vector<ClusterNode>();
-      }
-      Vector<ClusterNode> dead= cloneMembers(oldMembers);
-      dead.removeAll(newMembers);
-      this.log.debug("dead members: " + dead);
-      return dead;
-   }
-   
-   /**
-    * Helper method that returns a vector of new members from two input vectors: new and old vectors of two views.
-    * @param oldMembers Vector of old members
-    * @param allMembers Vector of new members
-    * @return Vector of members that have joined the partition between the two views
-    */
-   protected Vector<ClusterNode> getNewMembers(Vector<ClusterNode> oldMembers, Vector<ClusterNode> allMembers)
-   {
-      if(oldMembers == null)
-      {
-         oldMembers=new Vector<ClusterNode>();
-      }
-      if(allMembers == null)
-      {
-         allMembers=new Vector<ClusterNode>();
-      }
-      Vector<ClusterNode> newMembers= cloneMembers(allMembers);
-      newMembers.removeAll(oldMembers);
-      return newMembers;
-   }
-
-   @SuppressWarnings("deprecation")
-   protected void notifyListeners(ArrayList<HAMembershipListener> theListeners, long viewID,
-      Vector<ClusterNode> allMembers, Vector<ClusterNode> deadMembers, Vector<ClusterNode> newMembers,
-      Vector<List<ClusterNode>> originatingGroups)
-   {
-      this.log.debug("Begin notifyListeners, viewID: "+viewID);
-      List<HAMembershipListener> toNotify = null;
-      synchronized(theListeners)
-      {
-         // JBAS-3619 -- don't hold synch lock while notifying
-         toNotify = cloneListeners(theListeners);
-      }
-      
-      for (HAMembershipListener aListener : toNotify)
-      {
-         try
-         {
-            if(originatingGroups != null && (aListener instanceof HAMembershipExtendedListener))
-            {
-               HAMembershipExtendedListener exListener = (HAMembershipExtendedListener) aListener;
-               exListener.membershipChangedDuringMerge (deadMembers, newMembers,
-                  allMembers, originatingGroups);
-            }
-            else
-            {
-               aListener.membershipChanged(deadMembers, newMembers, allMembers);
-            }
-         }
-         catch (Throwable e)
-         {
-            // a problem in a listener should not prevent other members to receive the new view
-            this.log.warn("Membership listener callback failure: "+aListener, e);
-         }
-      }
-      
-      this.log.debug("End notifyListeners, viewID: "+viewID);
-   }
-   
    /*
     * Allows caller to specify whether the partition instance should be bound into JNDI.  Default value is true.
     * This method must be called before the partition is started as the binding occurs during startup.
@@ -1840,16 +321,6 @@
        return this.bindIntoJndi;
    }
 
-   public Executor getThreadPool()
-   {
-      return this.threadPool;
-   }
-
-   public void setThreadPool(Executor threadPool)
-   {
-      this.threadPool = threadPool;
-   }
-
    public synchronized HAPartitionDependencyCreator getHaPartitionDependencyCreator()
    {
       if (haPartitionDependencyCreator == null)
@@ -1864,31 +335,6 @@
       this.haPartitionDependencyCreator = haPartitionDependencyCreator;
    }
 
-   protected Vector<ClusterNode> translateAddresses(Vector<Address> addresses)
-   {
-      if (addresses == null)
-      {
-         return null;
-      }
-
-      Vector<ClusterNode> result = new Vector<ClusterNode>(addresses.size());
-      for (Address address: addresses)
-      {
-         result.add(getClusterNode(address));
-      }
-
-      return result;
-   }
-
-   public void logHistory (String message)
-   {
-      try
-      {
-         this.history.add(new SimpleDateFormat().format (new Date()) + " : " + message);
-      }
-      catch (Exception ignored){}
-   }
-
    // --------------------------------------------------- ClusterPartitionMBean
    
    @ManagementOperation(description="Gets a listing of significant events since " +
@@ -1896,14 +342,7 @@
                         impact=Impact.ReadOnly)
    public String showHistory()
    {
-      StringBuffer buff = new StringBuffer();
-      Vector<String> data = new Vector<String>(this.history);
-      for (java.util.Iterator<String> row = data.iterator(); row.hasNext();)
-      {
-         String info = row.next();
-         buff.append(info).append("\n");
-      }
-      return buff.toString();
+      return super.showHistory();
    }
 
    @ManagementOperation(description="Gets an XML format listing of significant events since " +
@@ -1911,95 +350,53 @@
                         impact=Impact.ReadOnly)
    public String showHistoryAsXML()
    {
-      StringBuffer buff = new StringBuffer();
-      buff.append("<events>\n");
-      Vector<String> data = new Vector<String>(this.history);
-      for (java.util.Iterator<String> row = data.iterator(); row.hasNext();)
-      {
-         buff.append("   <event>\n      ");
-         String info = row.next();
-         buff.append(info);
-         buff.append("\n   </event>\n");
-      }
-      buff.append("</events>\n");
-      return buff.toString();
+      return super.showHistoryAsXML();
    }
 
    @ManagementProperty(use={ViewUse.STATISTIC}, description="The release version of JGroups")
    public String getJGroupsVersion()
    {
-      return Version.description + "( " + Version.cvs + ")";
+      return super.getJGroupsVersion();
    }
-   
-   public DistributedReplicantManagerImpl getDistributedReplicantManagerImpl()
-   {
-      return this.replicantManager;
-   }
 
-   @SuppressWarnings("deprecation")
-   public org.jgroups.ChannelFactory getChannelFactory()
-   {
-      return this.channelFactory;
-   }
-
-   public HAPartitionCacheHandler getCacheHandler()
-   {
-      return this.cacheHandler;
-   }
-
-   public void setCacheHandler(HAPartitionCacheHandler cacheHandler)
-   {
-      this.cacheHandler = cacheHandler;
-      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;
+      return this.cacheHandler == null ? null : this.cacheHandler.getCacheConfigName();
    }
    
    @ManagementProperty(use={ViewUse.STATISTIC}, description="Name of the JGroups protocol stack configuration")
    public String getChannelStackName()
    {
-      return this.stackName;
+      return this.cacheHandler == null ? super.getChannelStackName() : this.cacheHandler.getChannelStackName();
    }
 
    @ManagementProperty(description="Time (in ms) to allow for state transfer to finish")
    public long getStateTransferTimeout() {
-      return this.state_transfer_timeout;
+      return super.getStateTransferTimeout();
    }
 
-   public void setStateTransferTimeout(long timeout)
-   {
-      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;
+      return super.getMethodCallTimeout();
    }
 
-   public void setMethodCallTimeout(long timeout)
+   public String getName()
    {
-      this.method_call_timeout = timeout;
+      return org.jboss.util.Classes.stripPackageName(log.getName());
    }
    
    // KernelControllerContextAware --------------------------------------------
    
-   @Override
    public void setKernelControllerContext(KernelControllerContext controllerContext) throws Exception
    {
-      super.setKernelControllerContext(controllerContext);
       this.kernelControllerContext = controllerContext;
    }
 
-   @Override
    public void unsetKernelControllerContext(KernelControllerContext controllerContext) throws Exception
    {
-      super.unsetKernelControllerContext(controllerContext);
       this.kernelControllerContext = null;
    }
    
@@ -2011,7 +408,10 @@
    @Override
    public void create() throws Exception
    {
-      super.create();
+      if (this.kernelControllerContext != null)
+         pojoChange(ControllerState.CREATE);
+      else
+         super.create();
    }
 
    @ManagementOperation(description="Start the HAPartition",
@@ -2019,7 +419,10 @@
    @Override
    public void start() throws Exception
    {
-      super.start();
+      if (this.kernelControllerContext != null)
+         pojoChange(ControllerState.START);
+      else
+         super.start();
    }
 
    @ManagementOperation(description="Stop the HAPartition",
@@ -2027,7 +430,10 @@
    @Override
    public void stop()
    {
-      super.stop();
+      if (this.kernelControllerContext != null)
+         pojoChange(ControllerState.CREATE);
+      else
+         super.stop();
    }
 
    @ManagementOperation(description="Destroy the HAPartition",
@@ -2035,7 +441,10 @@
    @Override
    public void destroy()
    {
-      super.destroy();
+      if (this.kernelControllerContext != null)
+         pojoChange(ControllerState.CONFIGURED);
+      else
+         super.destroy();
    }
    
    // ManagedObject interface for DRM ---------------------------------------
@@ -2044,14 +453,16 @@
          impact=Impact.ReadOnly)
    public String listDRMContent() throws Exception
    {
-      return this.replicantManager == null ? null : this.replicantManager.listContent();
+      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
+      return drm == null ? null : drm.listContent();
    }
 
    @ManagementOperation(description="List in XML format all known DistributedReplicantManager keys and the nodes that have registered bindings",
          impact=Impact.ReadOnly)
    public String listDRMContentAsXml() throws Exception
    {
-      return this.replicantManager == null ? null : this.replicantManager.listXmlContent();
+      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
+      return drm == null ? null : drm.listXmlContent();
    }
    
    @ManagementOperation(description="Returns the names of the nodes that have registered objects with the DistributedReplicantManager under the given key",
@@ -2060,7 +471,8 @@
                                                      description="The name of the service")})
    public List<String> lookupDRMNodeNames(String key)
    {
-      return this.replicantManager == null ? null : this.replicantManager.lookupReplicantsNodeNames(key);
+      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
+      return drm == null ? null : drm.lookupReplicantsNodeNames(key);
    }
    
    @ManagementOperation(description="Returns a hash of the list of nodes that " +
@@ -2070,7 +482,8 @@
                                                      description="The name of the service")})
    public int getDRMServiceViewId(String key)
    {
-      return this.replicantManager == null ? null : this.replicantManager.getReplicantsViewId(key);
+      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
+      return drm == null ? null : drm.getReplicantsViewId(key);
    }
    
    @ManagementOperation(description="Returns whether the DistributedReplicantManager considers this node to be the master for the given service",
@@ -2078,884 +491,75 @@
          params={@ManagementParameter(name="key", description="The name of the service")})
    public boolean isDRMMasterForService(String key)
    {
-      return this.replicantManager == null ? null : this.replicantManager.isMasterReplica(key);
+      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
+      return drm == null ? null : drm.isMasterReplica(key);
    }
    
    @ManagementOperation(description="Get a collection of the names of all keys for which the DistributedReplicantManager has bindings",
          impact=Impact.ReadOnly)
    public Collection<String> getDRMServiceNames()
    {
-      return this.replicantManager == null ? null : this.replicantManager.getAllServices();
+      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
+      return drm == null ? null : drm.getAllServices();
    }
+   
+   // Public -----------------------------------------------------------------
 
-   // Protected --------------------------------------------------------------
-      
-   /**
-    * Creates an object from a byte buffer
-    */
-   protected Object objectFromByteBufferInternal (byte[] buffer) throws Exception
+   public void setCacheHandler(HAPartitionCacheHandler handler)
    {
-      if(buffer == null)
-      {
-         return null;
-      }
+      this.cacheHandler = handler;
+   } 
 
-      ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
-      MarshalledValueInputStream mvis = new MarshalledValueInputStream(bais);
-      return mvis.readObject();
-   }
-   
-   /**
-    * Serializes an object into a byte buffer.
-    * The object has to implement interface Serializable or Externalizable
-    */
-   protected byte[] objectToByteBufferInternal (Object obj) throws Exception
+   @Create
+   public void pojoCreate() throws Exception
    {
-      ByteArrayOutputStream baos = new ByteArrayOutputStream();
-      MarshalledValueOutputStream mvos = new MarshalledValueOutputStream(baos);
-      mvos.writeObject(obj);
-      mvos.flush();
-      return baos.toByteArray();
+      super.create();
    }
    
-   /**
-    * Creates a response object from a byte buffer - optimized for response marshalling
-    */
-   protected Object objectFromByteBufferResponseInternal (byte[] buffer) throws Exception
+   @Start
+   public void pojoStart() throws Exception
    {
-      if(buffer == null)
-      {
-         return null;
-      }
-
-      if (buffer[0] == NULL_VALUE)
-      {
-         return null;
-      }
-
-      ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
-      // read past the null/serializable byte
-      bais.read();
-      MarshalledValueInputStream mvis = new MarshalledValueInputStream(bais);
-      return mvis.readObject();
+      super.start();
    }
-   
-   /**
-    * Serializes a response object into a byte buffer, optimized for response marshalling.
-    * The object has to implement interface Serializable or Externalizable
-    */
-   protected byte[] objectToByteBufferResponseInternal (Object obj) throws Exception
-   {
-      if (obj == null)
-      {
-         return new byte[]{NULL_VALUE};
-      }
 
-      ByteArrayOutputStream baos = new ByteArrayOutputStream();
-      // write a marker to stream to distinguish from null value stream
-      baos.write(SERIALIZABLE_VALUE);
-      MarshalledValueOutputStream mvos = new MarshalledValueOutputStream(baos);
-      mvos.writeObject(obj);
-      mvos.flush();
-      return baos.toByteArray();
-   }
-
-//   @Override
-//   public void postRegister(Boolean registrationDone)
-//   {
-//      super.postRegister(registrationDone);
-//      registerDRM();
-//   }
-   
-   
-   
-   // Private -------------------------------------------------------
-   
-   // Inner classes -------------------------------------------------
-
-   private class MessageListenerAdapter
-         implements ExtendedMessageListener
+   @Stop
+   public void pojoStop() throws Exception
    {
-      
-      public void getState(OutputStream stream)
-      {
-         ClusterPartition.this.logHistory ("getState called on partition");
-         
-         ClusterPartition.this.log.debug("getState called.");
-         try
-         {
-            ClusterPartition.this.getStateInternal(stream);
-         }
-         catch (Exception ex)
-         {
-            ClusterPartition.this.log.error("getState failed", ex);
-         }
-         
-      }
-      
-      public void getState(String state_id, OutputStream ostream)
-      {
-         // FIXME refactor to share logic
-         ClusterPartition.this.log.debug("getState called for service " + state_id);
-         
-         StateTransferProvider provider = stateProviders.get(state_id);
-         if (provider != null)
-         {
-            MarshalledValueOutputStream mvos = null;
-            // FIXME add a streaming api to StateTransferProvider
-            Object state = provider.getCurrentState();
-            try
-            {
-               mvos = new MarshalledValueOutputStream(ostream);
-               mvos.writeObject(state);
-            }
-            catch (Exception ex)
-            {
-               ClusterPartition.this.log.error("getState failed for service " + state_id, ex);
-            }
-            finally
-            {
-               if (mvos != null)
-               {
-                  try
-                  {
-                     mvos.flush();
-                     mvos.close();
-                  }
-                  catch (IOException ignored)
-                  {
-                     log.debug("Caught exception closing stream used for marshalling state", ignored);
-                  }
-               }
-            }
-         }
-      }
-
-      public byte[] getState(String state_id)
-      {
-         ClusterPartition.this.log.debug("getState called for service " + state_id);
-         
-         StateTransferProvider provider = stateProviders.get(state_id);
-         if (provider != null)
-         {
-            MarshalledValueOutputStream mvos = null;
-            Object state = provider.getCurrentState();
-            try
-            {
-               ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
-               mvos = new MarshalledValueOutputStream(baos);
-               mvos.writeObject(state);
-               mvos.flush();
-               mvos.close();
-               return baos.toByteArray();
-            }
-            catch (Exception ex)
-            {
-               ClusterPartition.this.log.error("getState failed for service " + state_id, ex);
-            }
-            finally
-            {
-               if (mvos != null)
-               {
-                  try
-                  {
-                     mvos.close();
-                  }
-                  catch (IOException ignored)
-                  {
-                     log.debug("Caught exception closing stream used for marshalling state", ignored);
-                  }
-               }
-            }
-         }
-
-         return null; // This will cause the receiver to get a "false" on the channel.getState() call
-      }
-      
-      public void setState(InputStream stream)
-      {
-         ClusterPartition.this.logHistory ("setState called on partition");
-         try
-         {
-            if (stream == null)
-            {
-               ClusterPartition.this.log.debug("transferred serviceState is null (may be first member in cluster)");
-            }
-            else
-            {
-               ClusterPartition.this.setStateInternal(stream);
-            }
-            
-            ClusterPartition.this.isStateSet = true;
-         }
-         catch (Throwable t)
-         {
-            ClusterPartition.this.recordSetStateFailure(t);
-         }
-         finally
-         {
-            // Notify waiting thread that serviceState has been set.
-            ClusterPartition.this.notifyChannelLock();
-         }
-      }
-
-      public byte[] getState()
-      {
-         ClusterPartition.this.logHistory ("getState called on partition");
-         
-         ClusterPartition.this.log.debug("getState called.");
-         try
-         {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
-            ClusterPartition.this.getStateInternal(baos);
-            return baos.toByteArray();
-         }
-         catch (Exception ex)
-         {
-            ClusterPartition.this.log.error("getState failed", ex);
-         }
-         return null; // This will cause the receiver to get a "false" on the channel.getState() call
-      }
-
-      public void setState(String state_id, byte[] state)
-      {
-         StateTransferTask task = ClusterPartition.this.stateTransferTasks.get(state_id);
-         if (task == null)
-         {
-            ClusterPartition.this.log.warn("No " + StateTransferTask.class.getSimpleName() + 
-                  " registered to receive state for service " + state_id);
-         }
-         else
-         {
-            task.setState(state);
-         }
-      }
-
-      public void setState(String state_id, InputStream istream)
-      {
-         StateTransferTask task = ClusterPartition.this.stateTransferTasks.get(state_id);
-         if (task == null)
-         {
-            ClusterPartition.this.log.warn("No " + StateTransferTask.class.getSimpleName() + 
-                  " registered to receive state for service " + state_id);
-         }
-         else
-         {
-            task.setState(istream);
-         }
-      }
-
-      public void receive(org.jgroups.Message msg)
-      { /* complete */}
-      
-      public void setState(byte[] obj)
-      {
-         ClusterPartition.this.logHistory ("setState called on partition");
-         try
-         {
-            if (obj == null)
-            {
-               ClusterPartition.this.log.debug("transferred serviceState is null (may be first member in cluster)");
-            }
-            else
-            {
-               ByteArrayInputStream bais = new ByteArrayInputStream(obj);
-               ClusterPartition.this.setStateInternal(bais);
-               bais.close();
-            }
-            
-            ClusterPartition.this.isStateSet = true;
-         }
-         catch (Throwable t)
-         {
-            ClusterPartition.this.recordSetStateFailure(t);
-         }
-         finally
-         {
-            // Notify waiting thread that serviceState has been set.
-            ClusterPartition.this.notifyChannelLock();
-         }
-      }
-      
+      super.stop();
    }
-
-   /**
-    * A simple data class containing the view change event needed to
-    * notify the HAMembershipListeners
-    */
-   private static class ViewChangeEvent
-   {
-      long viewId;
-      Vector<ClusterNode> deadMembers;
-      Vector<ClusterNode> newMembers;
-      Vector<ClusterNode> allMembers;
-      Vector<List<ClusterNode>> originatingGroups;
-   }
    
-   private class RequestMarshallerImpl implements org.jgroups.blocks.RpcDispatcher.Marshaller
+   @Destroy
+   public void pojoDestroy() throws Exception
    {
-
-      public Object objectFromByteBuffer(byte[] buf) throws Exception
-      {
-         return ClusterPartition.this.objectFromByteBufferInternal(buf);
-      }
-
-      public byte[] objectToByteBuffer(Object obj) throws Exception
-      {
-         // wrap MethodCall in Object[service_name, byte[]] so that service name is available during demarshalling
-         if (obj instanceof MethodCall)
-         {
-            String name = ((MethodCall)obj).getName();
-            int idx = name.lastIndexOf('.');
-            String serviceName = name.substring(0, idx);
-            return ClusterPartition.this.objectToByteBufferInternal(new Object[]{serviceName, ClusterPartition.this.objectToByteBufferInternal(obj)});
-         }
-
-         return ClusterPartition.this.objectToByteBufferInternal(obj);
-      }
+      super.destroy();
    }
    
-   private class ResponseMarshallerImpl implements org.jgroups.blocks.RpcDispatcher.Marshaller
-   {
-      
-      public Object objectFromByteBuffer(byte[] buf) throws Exception
-      {
-         boolean trace = ClusterPartition.this.log.isTraceEnabled();
-         Object retval = ClusterPartition.this.objectFromByteBufferResponseInternal(buf);
-         // HAServiceResponse is only received when a scoped classloader is required for unmarshalling
-         if (!(retval instanceof HAServiceResponse))
-         {
-            return retval;
-         }
-          
-         String serviceName = ((HAServiceResponse)retval).getServiceName();
-         byte[] payload = ((HAServiceResponse)retval).getPayload();
 
-         ClassLoader previousCL = null;
-         boolean overrideCL = false;
-         try
-         {
-            WeakReference<ClassLoader> weak = ClusterPartition.this.clmap.get(serviceName);
-            if (weak != null) // this should always be true since we only use HAServiceResponse when classloader is specified
-            {
-               previousCL = Thread.currentThread().getContextClassLoader();
-               ClassLoader loader = weak.get();
-               if( trace )
-               {
-                  ClusterPartition.this.log.trace("overriding response Thread ContextClassLoader for service " + serviceName);
-               }
-               overrideCL = true;
-               Thread.currentThread().setContextClassLoader(loader);
-            }
-            retval = ClusterPartition.this.objectFromByteBufferResponseInternal(payload);
-   
-            return retval;
-         }
-         finally
-         {
-            if (overrideCL == true)
-            {
-               ClusterPartition.this.log.trace("resetting response classloader");
-               Thread.currentThread().setContextClassLoader(previousCL);
-            }
-         }
-      }
-
-      public byte[] objectToByteBuffer(Object obj) throws Exception
-      {
-         return ClusterPartition.this.objectToByteBufferResponseInternal(obj);
-      }
-   }
-   
-   /**
-    * Overrides RpcDispatcher.Handle so that we can dispatch to many
-    * different objects.
-    */
-   private class RpcHandler extends RpcDispatcher
-   {
-      private RpcHandler(Channel channel, MessageListener l, MembershipListener l2, Object server_obj,
-            boolean deadlock_detection)
-      {
-         //deadlock detection has been deprecated since JGroups 2.10
-         super(channel, l, l2, server_obj);
-      }
+   // Protected --------------------------------------------------------------
       
-      /**
-       * Analyze the MethodCall contained in <code>req</code> to find the
-       * registered service object to invoke against, and then execute it
-       * against *that* object and return result.
-       *
-       * This overrides RpcDispatcher.Handle so that we can dispatch to many different objects.
-       * @param req The org.jgroups. representation of the method invocation
-       * @return The serializable return value from the invocation
-       */
-      public Object handle(Message req)
-      {
-         Object body = null;
-         Object retval = null;
-         Object handler = null;
-         boolean trace = this.log.isTraceEnabled();
-         boolean overrideCL = false;
-         ClassLoader previousCL = null;
-         String service = null;
-         byte[] request_bytes = null;
-         
-         if( trace )
-         {
-            this.log.trace("Partition " + ClusterPartition.this.getPartitionName() + " received msg");
-         }
-         if(req == null || req.getBuffer() == null)
-         {
-            this.log.warn("Partition " + ClusterPartition.this.getPartitionName() + " message or message buffer is null!");
-            return null;
-         }
-         
-         try
-         {
-            Object wrapper = ClusterPartition.this.objectFromByteBufferInternal(req.getBuffer());
-            if(wrapper == null || !(wrapper instanceof Object[]))
-            {
-               this.log.warn("Partition " + ClusterPartition.this.getPartitionName() + " message wrapper does not contain Object[] object!");
-               return null;
-            }
+   // Private ----------------------------------------------------------------
 
-            // wrapper should be Object[]{service_name, byte[]}
-            Object[] temp = (Object[])wrapper;
-            service = (String)temp[0];
-            request_bytes = (byte[])temp[1];
 
-            // see if this node has registered to handle this service
-            handler = ClusterPartition.this.rpcHandlers.get(service);
-            if (handler == null)
-            {
-               if( trace )
-               {
-                  this.log.trace("Partition " + ClusterPartition.this.getPartitionName() + " no rpc handler registered under service " + service);
-               }
-               return new NoHandlerForRPC();
-            }
-         }
-         catch(Exception e)
-         {
-            this.log.warn("Partition " + ClusterPartition.this.getPartitionName() + " failed unserializing message buffer (msg=" + req + ")", e);
-            return null;
-         }
-         
-         try
-         {
-            // If client registered the service with a classloader, override the thread classloader here
-            WeakReference<ClassLoader> weak = ClusterPartition.this.clmap.get(service);
-            if (weak != null)
-            {
-               if( trace )
-               {
-                  this.log.trace("overriding Thread ContextClassLoader for RPC service " + service);
-               }
-               previousCL = Thread.currentThread().getContextClassLoader();
-               ClassLoader loader = weak.get();
-               overrideCL = true;
-               Thread.currentThread().setContextClassLoader(loader);
-            }
-            body = ClusterPartition.this.objectFromByteBufferInternal(request_bytes);
-         }
-         catch (Exception e)
-         {
-            this.log.warn("Partition " + ClusterPartition.this.getPartitionName() + " failed extracting message body from request bytes", e);
-            return null;
-         }
-         finally
-         {
-            if (overrideCL)
-            {
-               this.log.trace("resetting Thread ContextClassLoader");
-               Thread.currentThread().setContextClassLoader(previousCL);
-            }
-         }
-         
-         if(body == null || !(body instanceof MethodCall))
-         {
-            this.log.warn("Partition " + ClusterPartition.this.getPartitionName() + " message does not contain a MethodCall object!");
-            return null;
-         }
-         
-         // get method call information
-         MethodCall method_call = (MethodCall)body;
-         String methodName = method_call.getName();
-         
-         if( trace )
-         {
-            this.log.trace("full methodName: " + methodName);
-         }
-         
-         int idx = methodName.lastIndexOf('.');
-         String handlerName = methodName.substring(0, idx);
-         String newMethodName = methodName.substring(idx + 1);
-         if( trace )
-         {
-            this.log.trace("handlerName: " + handlerName + " methodName: " + newMethodName);
-            this.log.trace("Handle: " + methodName);
-         }
-         
-         // prepare method call
-         method_call.setName(newMethodName);
-
-         /* Invoke it and just return any exception with trace level logging of
-         the exception. The exception semantics of a group rpc call are weak as
-         the return value may be a normal return value or the exception thrown.
-         */
-         try
-         {
-            retval = method_call.invoke(handler);
-            if (overrideCL)
-            {
-               // wrap the response so that the service name can be accessed during unmarshalling of the response
-               byte[] retbytes = ClusterPartition.this.objectToByteBufferResponseInternal(retval);
-               retval = new HAServiceResponse(handlerName, retbytes);
-            }
-            if( trace )
-            {
-               this.log.trace("rpc call return value: " + retval);
-            }
-         }
-         catch (Throwable t)
-         {
-            if( trace )
-            {
-               this.log.trace("Partition " + ClusterPartition.this.getPartitionName() + " rpc call threw exception", t);
-            }
-            retval = t;
-         }
-
-         return retval;
-      }
-      
-   }
-   /**
-    * Copyright (c) 2005 Brian Goetz and Tim Peierls
-    * Released under the Creative Commons Attribution License
-    * (http://creativecommons.org/licenses/by/2.5)
-    * Official home: http://www.jcip.net
-    * 
-    * ThreadGate <p/> Recloseable gate using wait and notifyAll
-    * 
-    * @author Brian Goetz and Tim Peierls
-    */
-
-   private static class ThreadGate
+   private void pojoChange(ControllerState state)
    {
-      private static final int OPEN = 1;
-      private static final int CLOSED = -1;
-      
-      private static class Sync extends AbstractQueuedSynchronizer
+      Controller controller = kernelControllerContext.getController();
+      try
       {
-         /** The serialVersionUID */
-         private static final long serialVersionUID = 1L;
-         
-         Sync(int state)
-         {
-            this.setState(state);
-         }
-         
-         @Override
-         protected int tryAcquireShared(int ingored)
-         {
-            return this.getState();
-         }
-
-         @Override
-         protected boolean tryReleaseShared(int state)
-         {
-            this.setState(state);
-            return true;
-         }
+         controller.change(kernelControllerContext, state);
       }
-
-      private final Sync sync = new Sync(CLOSED);
-      
-      public void open()
+      catch (RuntimeException e)
       {
-         this.sync.releaseShared(OPEN);
+         throw e;
       }
-      
-      public void close()
+      catch (Error e)
       {
-         this.sync.releaseShared(CLOSED);
+         throw e;
       }
-      
-      public boolean await(long timeout) throws InterruptedException
+      catch (Throwable t)
       {
-         return this.sync.tryAcquireSharedNanos(0, TimeUnit.MILLISECONDS.toNanos(timeout));
+         throw new RuntimeException("Error changing state of " + kernelControllerContext.getName() + " to " + state.getStateString(), t);
       }
    }
+   // Inner classes ----------------------------------------------------------
    
-   private void setupLoggers(String partitionName)
-   {
-      if (partitionName == null)
-      {
-         this.log = Logger.getLogger(HAPartition.class.getName());
-         this.clusterLifeCycleLog = Logger.getLogger(HAPartition.class.getName() + ".lifecycle");
-      }
-      else
-      {
-         this.log = Logger.getLogger(HAPartition.class.getName() + "." + partitionName);
-         this.clusterLifeCycleLog = Logger.getLogger(HAPartition.class.getName() + ".lifecycle." + partitionName);
-      }
-   }
-   
-   @SuppressWarnings("deprecation")
-   private static class GroupMembershipListenerAdapter implements AsynchHAMembershipExtendedListener
-   {
-      private final GroupMembershipListener listener;
-      
-      GroupMembershipListenerAdapter(GroupMembershipListener listener)
-      {
-         this.listener = listener;
-      }
-
-      public void membershipChangedDuringMerge(Vector<ClusterNode> deadMembers, Vector<ClusterNode> newMembers,
-            Vector<ClusterNode> allMembers, Vector<List<ClusterNode>> originatingGroups)
-      {
-         listener.membershipChangedDuringMerge(deadMembers, newMembers, allMembers, originatingGroups);
-      }
-
-      public void membershipChanged(Vector<ClusterNode> deadMembers, Vector<ClusterNode> newMembers,
-            Vector<ClusterNode> allMembers)
-      {
-         listener.membershipChanged(deadMembers, newMembers, allMembers);
-      }
-
-      @Override
-      public boolean equals(Object obj)
-      {
-         boolean result = obj instanceof GroupMembershipListenerAdapter;
-         if (result)
-         {
-            result = listener == ((GroupMembershipListenerAdapter) obj).listener;
-         }
-         return result;
-      }
-
-      @Override
-      public int hashCode()
-      {
-         return listener.hashCode();
-      }
-   }
-   
-   private class StateTransferTask implements Callable<Serializable>
-   {
-      private final String serviceName;
-      private final WeakReference<ClassLoader> classloader;
-      private Serializable result;
-      private boolean isStateSet;
-      private Exception setStateException;
-      
-      StateTransferTask(String serviceName, ClassLoader cl)
-      {
-         this.serviceName = serviceName;
-         if (cl != null)
-         {
-            classloader = null;
-         }
-         else
-         {
-            classloader = new WeakReference<ClassLoader>(cl);
-         }
-      }
-
-      public Serializable call() throws Exception
-      {
-         boolean intr = false;
-         try
-         {
-            long start, stop;
-            this.isStateSet = false;
-            start = System.currentTimeMillis();
-            boolean rc = ClusterPartition.this.channel.getState(null, serviceName, ClusterPartition.this.getStateTransferTimeout());
-            if (rc)
-            {
-               synchronized (this)
-               {
-                  while (!this.isStateSet)
-                  {
-                     if (this.setStateException != null)
-                     {
-                        throw this.setStateException;
-                     }
-
-                     try
-                     {
-                        wait();
-                     }
-                     catch (InterruptedException iex)
-                     {
-                        intr = true;
-                     }
-                  }
-               }
-               stop = System.currentTimeMillis();
-               ClusterPartition.this.log.debug("serviceState was retrieved successfully (in " + (stop - start) + " milliseconds)");
-            }
-            else
-            {
-               // No one provided us with serviceState.
-               // We need to find out if we are the coordinator, so we must
-               // block until viewAccepted() is called at least once
-
-               synchronized (ClusterPartition.this.members)
-               {
-                  while (ClusterPartition.this.members.size() == 0)
-                  {
-                     ClusterPartition.this.log.debug("waiting on viewAccepted()");
-                     try
-                     {
-                        ClusterPartition.this.members.wait();
-                     }
-                     catch (InterruptedException iex)
-                     {
-                        intr = true;
-                     }
-                  }
-               }
-
-               if (ClusterPartition.this.isCurrentNodeCoordinator())
-               {
-                  ClusterPartition.this.log.debug("State could not be retrieved for service " + serviceName + " (we are the first member in group)");
-               }
-               else
-               {
-                  throw new IllegalStateException("Initial serviceState transfer failed: " +
-                     "Channel.getState() returned false");
-               }
-            }
-         }
-         finally
-         {
-            if (intr) Thread.currentThread().interrupt();
-         }
-         
-         return result;
-      }     
-      
-      void setState(byte[] state)
-      {
-         try
-         {
-            if (state == null)
-            {
-               ClusterPartition.this.log.debug("transferred state for service " + 
-                     serviceName + " is null (may be first member in cluster)");
-            }
-            else
-            {
-               ByteArrayInputStream bais = new ByteArrayInputStream(state);
-               setStateInternal(bais);
-               bais.close();
-            }
-            
-            this.isStateSet = true;
-         }
-         catch (Throwable t)
-         {
-            recordSetStateFailure(t);
-         }
-         finally
-         {
-            // Notify waiting thread that serviceState has been set.
-            synchronized(this)
-            {
-               notifyAll();
-            }
-         }
-      }     
-      
-      void setState(InputStream state)
-      {
-         try
-         {
-            if (state == null)
-            {
-               ClusterPartition.this.log.debug("transferred state for service " + 
-                     serviceName + " is null (may be first member in cluster)");
-            }
-            else
-            {
-               setStateInternal(state);
-            }
-            
-            this.isStateSet = true;
-         }
-         catch (Throwable t)
-         {
-            recordSetStateFailure(t);
-         }
-         finally
-         {
-            // Notify waiting thread that serviceState has been set.
-            synchronized(this)
-            {
-               notifyAll();
-            }
-         }
-         
-      }
-      
-      private void setStateInternal(InputStream is) throws IOException, ClassNotFoundException
-      {
-         ClassLoader cl = getStateTransferClassLoader();
-         SwitchContext switchContext = ClusterPartition.this.classLoaderSwitcher.getSwitchContext(cl);
-         try
-         {
-            MarshalledValueInputStream mvis = new MarshalledValueInputStream(is);
-            this.result = (Serializable) mvis.readObject();
-         }
-         finally
-         {
-            switchContext.reset();
-         }
-      }
-
-      private void recordSetStateFailure(Throwable t)
-      {
-         ClusterPartition.this.log.error("failed setting serviceState for service " + serviceName, t);
-         if (t instanceof Exception)
-         {
-            this.setStateException = (Exception) t;
-         }
-         else
-         {
-            this.setStateException = new Exception(t);
-         }
-      }
-      
-      private ClassLoader getStateTransferClassLoader()
-      {
-         ClassLoader cl = classloader == null ? null : classloader.get();
-         if (cl == null)
-         {
-            cl = this.getClass().getClassLoader();
-         }
-         return cl;
-      }
-      
-   }
-   
-   @SuppressWarnings("unchecked")
-   private static Vector<Address> cloneMembers(View view)
-   {
-      return (Vector<Address>) view.getMembers().clone();
-   }
-   
-   @SuppressWarnings("unchecked")
-   private static Vector<ClusterNode> cloneMembers(Vector<ClusterNode> toClone)
-   {
-      return (Vector<ClusterNode>) toClone.clone();
-   }
-   
-   @SuppressWarnings({"unchecked","deprecation"})
-   private static List<HAMembershipListener> cloneListeners(ArrayList<HAMembershipListener> toClone)
-   {
-      return (List<HAMembershipListener>) toClone.clone();
-   }
-   
 }

Modified: trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartitionMBean.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartitionMBean.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartitionMBean.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -24,6 +24,7 @@
 import java.util.List;
 
 import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.system.Service;
 
 /** 
  * MBean interface for ClusterPartition.
@@ -34,8 +35,7 @@
  *
  * <p><b>Revisions:</b><br>
  */
-public interface ClusterPartitionMBean
-   extends org.jboss.system.ServiceMBean
+public interface ClusterPartitionMBean extends Service
 {
    /**
     * Name of the partition being built. All nodes/services belonging to 
@@ -113,4 +113,10 @@
     * @return
     */
    String showHistoryAsXML ();
+   
+   String getName();
+   int getState();
+   String getStateString();
+   
+   
 }

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,1123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.ha.framework.interfaces.ClusterNode;
-import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
-import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.logging.Logger;
-
-
-/**
- * This class manages replicated objects.
- * 
- * @author  <a href="mailto:bill at burkecentral.com">Bill Burke</a>.
- * @author  <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- * @author  Scott.stark at jboss.org
- * @author  <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- * @author  <a href="mailto:pferraro at redhat.com">Paul Ferraro</a>
- * @version $Revision$
- */
-public class DistributedReplicantManagerImpl
-   implements DistributedReplicantManagerImplMBean,
-              HAPartition.HAMembershipExtendedListener,
-              HAPartition.HAPartitionStateTransfer,
-              AsynchEventHandler.AsynchEventProcessor
-{
-   // 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 final AtomicInteger threadID = new AtomicInteger();
-   
-   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 final HAPartition partition;
-   /** The handler used to send replicant change notifications asynchronously */
-   private final AsynchEventHandler asynchHandler;
-   
-   private final Logger log;
-   
-   private String nodeName = null;
-   
-   // Works like a simple latch
-   private volatile CountDownLatch partitionNameKnown = new CountDownLatch(1);
-
-   // Static --------------------------------------------------------
-   
-   // Constructors --------------------------------------------------
-   
-   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");
-   }
-
-   // Public --------------------------------------------------------
-   
-   public void createService() throws Exception
-   {
-      if (this.partition == null)
-      {
-         throw new IllegalStateException("HAPartition property must be set before creating DistributedReplicantManager service");
-      }
-
-      this.log.debug("registerRPCHandler");
-      this.partition.registerRPCHandler(SERVICE_NAME, this);
-      this.log.debug("subscribeToStateTransferEvents");
-      this.partition.subscribeToStateTransferEvents(SERVICE_NAME, this);
-      this.log.debug("registerMembershipListener");
-      this.partition.registerMembershipListener(this);
-   }
-   
-   public void startService() throws Exception
-   {
-      this.nodeName = this.partition.getNodeName();
-      
-      this.asynchHandler.start();
-
-      this.partitionNameKnown.countDown(); // partition name is now known!
-      
-      //log.info("mergemembers");
-      //mergeMembers();
-   }
-   
-   public void stopService() throws Exception
-   {
-      // Stop the asynch handler thread
-      try
-      {
-         this.asynchHandler.stop();
-      }
-      catch( Exception e)
-      {
-         this.log.warn("Failed to stop asynchHandler", e);
-      }
-      
-      // Reset the latch
-      this.partitionNameKnown = new CountDownLatch(1);
-   }
-
-   // NR 200505 : [JBCLUSTER-38] unbind at destroy
-   public void destroyService() throws Exception
-   {
-      // we cleanly shutdown. This should be optimized.
-      for (String key: this.localReplicants.keySet())
-      {
-         this.removeLocal(key); // channel is disconnected, so don't try to notify cluster
-      }
-      
-      if (this.partition != null)
-      {
-         this.partition.unregisterRPCHandler(SERVICE_NAME, this);
-         this.partition.unsubscribeFromStateTransferEvents(SERVICE_NAME, this);
-         this.partition.unregisterMembershipListener(this);
-      }
-   }
-
-   public void registerWithJmx(MBeanServer server) throws Exception
-   {
-      server.registerMBean(this, this.getObjectName());
-   }
-   
-   public void unregisterWithJmx(MBeanServer server) throws Exception
-   {
-      server.unregisterMBean(this.getObjectName());
-   }
-   
-   private ObjectName getObjectName() throws Exception
-   {
-      return new ObjectName("jboss:service=" + SERVICE_NAME + ",partition=" + this.partition.getPartitionName());
-   }
-   
-//   @ManagementProperty(use={ViewUse.STATISTIC}, description="The partition's name")
-//   @ManagementObjectID(type="DistributedReplicantManager")
-   public String getPartitionName()
-   {
-      return this.partition.getPartitionName();
-   }
-
-//   public void setHAPartition(HAPartition clusterPartition)
-//   {
-//      this.partition = clusterPartition;
-//   }
-   
-//   @ManagementOperation(name="listDRMContent",
-//         description="List all known keys and the nodes that have registered bindings",
-//         impact=Impact.ReadOnly)
-   public String listContent() throws Exception
-   {
-      StringBuilder result = new StringBuilder();
-      
-      result.append("<pre>");
-
-      // we merge all replicants services: local only or not
-      //
-      for (String category: this.getAllServices())
-      {
-         result.append("-----------------------------------------------\n");
-         result.append("Service : ").append(category).append("\n\n");
-         
-         Serializable local = this.localReplicants.get(category);
-         
-         if (local == null)
-         {
-            result.append("\t- Service is *not* available locally\n");
-         }
-         else
-         {
-            result.append("\t- Service *is* also available locally\n");
-         }
-
-         Map<String, Serializable> content = this.replicants.get(category);
-         
-         if (content != null)
-         {
-            for (String location: content.keySet())
-            {
-               result.append("\t- ").append(location).append("\n");
-            }
-         }
-         
-         result.append ("\n");
-         
-      }
-      
-      result.append ("</pre>");
-      
-      return result.toString();
-   }
-   
-//   @ManagementOperation(name="listDRMContentAsXml",
-//         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();
-      
-      result.append ("<ReplicantManager>\n");
-
-      // we merge all replicants services: local only or not
-      //
-      for (String category: this.getAllServices())
-      {
-         result.append("\t<Service>\n");
-         result.append("\t\t<ServiceName>").append(category).append("</ServiceName>\n");
-
-         Serializable local = this.localReplicants.get(category);
-         
-         if (local != null)
-         {
-            result.append("\t\t<Location>\n");
-            result.append("\t\t\t<Name local=\"True\">").append (this.nodeName).append ("</Name>\n");
-            result.append("\t\t</Location>\n");
-         }
-
-         Map<String, Serializable> content = this.replicants.get(category);
-         
-         if (content != null)
-         {
-            for (String location: content.keySet())
-            {
-               result.append("\t\t<Location>\n");
-               result.append("\t\t\t<Name local=\"False\">").append (location).append ("</Name>\n");
-               result.append("\t\t</Location>\n");
-            }
-         }
-         
-         result.append("\t</Service>\n");
-      }
-
-      result.append("</ReplicantManager>\n");
-      
-      return result.toString();
-   }
-
-   // HAPartition.HAPartitionStateTransfer implementation ----------------------------------------------
-   
-   public Serializable getCurrentState()
-   {
-      Map<String, ConcurrentMap<String, Serializable>> result = new HashMap<String, ConcurrentMap<String, Serializable>>();
-      
-      for (String category: this.getAllServices())
-      {
-         ConcurrentMap<String, Serializable> map = new ConcurrentHashMap<String, Serializable>();
-         
-         ConcurrentMap<String, Serializable> content = this.replicants.get(category);
-         
-         if (content != null)
-         {
-            map.putAll(content);
-         }
-         
-         Serializable local = this.localReplicants.get(category);
-         
-         if (local != null)
-         {
-            map.put(this.nodeName, local);
-         }
-         
-         result.put(category, map);
-      }
-      
-      // we add the intraviewid cache to the global result
-      //
-      return new Object[] { result, this.intraviewIdCache };
-   }
-
-   @SuppressWarnings("unchecked")
-   public void setCurrentState(Serializable newState)
-   {
-      Object[] globalState = (Object[]) newState;
-      Map<String, ConcurrentMap<String, Serializable>> map = (Map) globalState[0];
-      
-      this.replicants.putAll(map);
-      
-      this.intraviewIdCache = (Map) globalState[1];
-
-      if (this.log.isTraceEnabled())
-      {
-         this.log.trace(this.nodeName + ": received new state, will republish local replicants");
-      }
-      
-      new MembersPublisher().start();
-   }
-      
-//   @ManagementOperation(name="getAllDRMServices",
-//         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>();
-      services.addAll(this.localReplicants.keySet());
-      services.addAll(this.replicants.keySet());
-      return services;
-   }
-   
-   // 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
-      // and then notify all listening nodes.
-      //
-      this.log.info("Merging partitions...");
-      this.log.info("Dead members: " + deadMembers.size());
-      this.log.info("Originating groups: " + originatingGroups);
-      this.purgeDeadMembers(deadMembers, true);
-      if (newMembers.size() > 0)
-      {
-         new MergeMembers().start();
-      }
-   }
-   
-   @SuppressWarnings("unchecked")
-   public void membershipChanged(Vector deadMembers, Vector newMembers, Vector allMembers)
-   {
-      // Here we only care about deadMembers.  Purge all replicant lists of deadMembers
-      // and then notify all listening nodes.
-      //
-      this.log.info("I am (" + this.nodeName + ") received membershipChanged event:");
-      this.log.info("Dead members: " + deadMembers.size() + " (" + deadMembers + ")");
-      this.log.info("New Members : " + newMembers.size()  + " (" + newMembers + ")");
-      this.log.info("All Members : " + allMembers.size()  + " (" + allMembers + ")");
-      this.purgeDeadMembers(deadMembers, false);
-      
-      // we don't need to merge members anymore
-   }
-   
-   // AsynchEventHandler.AsynchEventProcessor implementation -----------------
-   
-   public void processEvent(Object event)
-   {
-      KeyChangeEvent kce = (KeyChangeEvent) event;
-      this.notifyKeyListeners(kce.key, kce.replicants, kce.merge);
-   }
-   
-   static class KeyChangeEvent
-   {
-      String key;
-      List<Serializable> replicants;
-      boolean merge;
-   }
-   
-   // DistributedReplicantManager implementation ----------------------------------------------
-   
-   public void add(String key, Serializable replicant) throws Exception
-   {
-      if (this.log.isTraceEnabled())
-      {
-         this.log.trace("add, key=" + key + ", value=" + replicant);
-      }
-      
-      this.partitionNameKnown.await(); // we don't propagate until our name is known
-      
-      Object[] args = { key, this.nodeName, replicant };
-      
-      this.partition.callMethodOnCluster(SERVICE_NAME, "_add", args, add_types, true);
-
-      List<Serializable> replicants = null;
-      
-      synchronized (this.localReplicants)
-      {
-         this.localReplicants.put(key, replicant);
-         
-         replicants = this.getReplicants(key);
-      }
-      
-      this.notifyKeyListeners(key, replicants, false);
-   }
-   
-   public void remove(String key) throws Exception
-   {
-      this.partitionNameKnown.await(); // we don't propagate until our name is known
-      
-      // optimisation: we don't make a costly network call
-      // if there is nothing to remove
-      if (this.localReplicants.containsKey(key))
-      {
-         Object[] args = { key, this.nodeName };
-         
-         this.partition.callAsynchMethodOnCluster(SERVICE_NAME, "_remove", args, remove_types, true);
-         
-         this.removeLocal(key);
-      }
-   }
-   
-   private void removeLocal(String key)
-   {
-      List<Serializable> replicants = null;
-      
-      synchronized (this.localReplicants)
-      {
-         if (this.localReplicants.remove(key) != null)
-         {
-            replicants = this.getReplicants(key);
-         }
-      }
-      
-      if (replicants != null)
-      {
-         this.notifyKeyListeners(key, replicants, false);
-      }
-   }
-   
-   public Serializable lookupLocalReplicant(String key)
-   {
-      return this.localReplicants.get(key);
-   }
-   
-   public List<Serializable> lookupReplicants(String key)
-   {
-      Serializable local = this.localReplicants.get(key);
-      
-      Map<String, Serializable> replicant = this.replicants.get(key);
-
-      if (replicant == null)
-      {
-         return (local != null) ? Collections.singletonList(local) : null;
-      }
-
-      // JBAS-2677. Put the replicants in view order.
-      ClusterNode[] nodes = this.partition.getClusterNodes();
-
-      List<Serializable> result = new ArrayList<Serializable>(nodes.length);
-      
-      for (ClusterNode node: nodes)
-      {
-         String name = node.getName();
-         
-         if (local != null && this.nodeName.equals(name))
-         {
-            result.add(local);
-         }
-         else
-         {
-            Serializable value = replicant.get(name);
-            
-            if (value != null)
-            {
-               result.add(value);
-            }
-         }
-      }
-      
-      return result;
-   }
-   
-   private List<Serializable> getReplicants(String key)
-   {
-      List<Serializable> result = this.lookupReplicants(key);
-      
-      if (result == null)
-      {
-         result = Collections.emptyList();
-      }
-      
-      return result;
-   }
-
-//   @ManagementOperation(name="lookupDRMNodeNames",
-//         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);
-      
-      if (nodes == null) return null;
-      
-      List<String> nodeNames = new ArrayList<String>(nodes.size());
-      
-      for (ClusterNode node : nodes)
-      {
-         nodeNames.add(node.getName());
-      }
-      
-      return nodeNames;
-   }
-
-   public List<ClusterNode> lookupReplicantsNodes(String key)
-   {
-      boolean local = this.localReplicants.containsKey(key);
-      Map<String, Serializable> replicant = this.replicants.get(key);
-      
-      if (replicant == null)
-      {
-         return local ? Collections.singletonList(this.partition.getClusterNode()) : null;
-      }
-      
-      Set<String> keys = replicant.keySet();
-      ClusterNode[] nodes = this.partition.getClusterNodes();
-      List<ClusterNode> rtn = new ArrayList<ClusterNode>(nodes.length);
-
-      for (ClusterNode node : nodes)
-      {
-         String name = node.getName();
-         
-         if (local && this.nodeName.equals(name))
-         {
-            rtn.add(this.partition.getClusterNode());
-         }
-         else if (keys.contains(name))
-         {
-            rtn.add(node);
-         }
-      }
-      
-      return rtn;
-   }
-   
-   public void registerListener(String key, ReplicantListener subscriber)
-   {
-      List<ReplicantListener> list = new CopyOnWriteArrayList<ReplicantListener>();
-      
-      List<ReplicantListener> existing = this.keyListeners.putIfAbsent(key, list);
-      
-      ((existing != null) ? existing : list).add(subscriber);
-   }
-   
-   public void unregisterListener(String key, DistributedReplicantManager.ReplicantListener subscriber)
-   {
-      List<ReplicantListener> listeners = this.keyListeners.get(key);
-      
-      if (listeners != null)
-      {
-         listeners.remove(subscriber);
-         
-         this.keyListeners.remove(key, Collections.emptyList());
-      }
-   }
-   
-//   @ManagementOperation(name="getDRMServiceViewId",
-//         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);
-      
-      return (result != null) ? result.intValue() : 0;
-   }
-   
-//   @ManagementOperation(name="isDRMMasterForService",
-//         description="Returns whether the DRM considers this node to be the master for the given service",
-//         impact=Impact.ReadOnly,
-//         params={@ManagementParameter(name="key", description="The name of the service")})
-   public boolean isMasterReplica(String key)
-   {
-      if (this.log.isTraceEnabled())
-      {
-         this.log.trace("isMasterReplica, key=" + key);
-      }
-      // if I am not a replicant, I cannot be the master...
-      //
-      if (!this.localReplicants.containsKey(key))
-      {
-         if (this.log.isTraceEnabled())
-         {
-            this.log.trace("no localReplicants, key=" + key + ", isMasterReplica=false");
-         }
-         return false;
-      }
-
-      Map<String, Serializable> repForKey = this.replicants.get(key);
-      if (repForKey == null)
-      {
-         if (this.log.isTraceEnabled())
-         {
-            this.log.trace("no replicants, key=" + key + ", isMasterReplica=true");
-         }
-         return true;
-      }
-
-      List<String> allNodes = this.partition.getCurrentView();
-      for (String node: allNodes)
-      {
-         if (this.log.isTraceEnabled())
-         {
-            this.log.trace("Testing member: " + node);
-         }
-         
-         if (repForKey.containsKey(node))
-         {
-            if (this.log.isTraceEnabled())
-            {
-               this.log.trace("Member found in replicaNodes, isMasterReplica=false");
-            }
-            return false;
-         }
-         else if (node.equals(this.nodeName))
-         {
-            if (this.log.isTraceEnabled())
-            {
-               this.log.trace("Member == nodeName, isMasterReplica=true");
-            }
-            return true;
-         }
-      }
-      return false;
-   }
-
-   // DistributedReplicantManager cluster callbacks ----------------------------------------------
-   
-   /**
-    * Cluster callback called when a new replicant is added on another node
-    * @param key Replicant key
-    * @param nodeName Node that add the current replicant
-    * @param replicant Serialized representation of the replicant
-    */
-   public void _add(String key, String nodeName, Serializable replicant)
-   {
-      if (this.log.isTraceEnabled())
-      {
-         this.log.trace("_add(" + key + ", " + nodeName);
-      }
-      
-      KeyChangeEvent event = new KeyChangeEvent();
-      event.key = key;
-      
-      synchronized (this.replicants)
-      {
-         this.addReplicant(key, nodeName, replicant);
-         
-         event.replicants = this.getReplicants(key);
-      }
-      
-      try
-      {
-         this.asynchHandler.queueEvent(event);
-      }
-      catch (InterruptedException e)
-      {
-         Thread.currentThread().interrupt();
-         
-         this.log.error("_add failed", e);
-      }
-   }
-   
-   /**
-    * Cluster callback called when a replicant is removed by another node
-    * @param key Name of the replicant key
-    * @param nodeName Node that wants to remove its replicant for the give key
-    */
-   public void _remove(String key, String nodeName)
-   {
-      KeyChangeEvent event = new KeyChangeEvent();
-      event.key = key;
-      
-      synchronized (this.replicants)
-      {
-         if (this.removeReplicant(key, nodeName))
-         {
-            event.replicants = this.getReplicants(key);
-         }
-      }
-      
-      if (event.replicants != null)
-      {
-         try
-         {
-            this.asynchHandler.queueEvent(event);
-         }
-         catch (InterruptedException e)
-         {
-            Thread.currentThread().interrupt();
-            
-            this.log.error("_remove failed", e);
-         }
-      }
-   }
-   
-   protected boolean removeReplicant(String key, String nodeName)
-   {
-      Map<String, Serializable> replicant = this.replicants.get(key);
-      
-      if (replicant != null)
-      {
-         if (replicant.remove(nodeName) != null)
-         {
-            // If replicant map is empty, prune it
-            this.replicants.remove(key, Collections.emptyMap());
-            
-            return true;
-         }
-      }
-      
-      return false;
-   }
-   
-   /**
-    * Cluster callback called when a node wants to know our complete list of local replicants
-    * @throws Exception Thrown if a cluster communication exception occurs
-    * @return A java array of size 2 containing the name of our node in this cluster and the serialized representation of our state
-    */
-   public Object[] lookupLocalReplicants() throws Exception
-   {
-      this.partitionNameKnown.await(); // we don't answer until our name is known
-      
-      Object[] rtn = { this.nodeName, this.localReplicants };
-      
-      if (this.log.isTraceEnabled())
-      {
-         this.log.trace("lookupLocalReplicants called ("+ rtn[0] + "). Return: " + this.localReplicants.size());
-      }
-      
-      return rtn;
-   }
-   
-   // Package protected ---------------------------------------------
-   
-   // Protected -----------------------------------------------------
-   
-   protected int calculateReplicantsHash(List<ClusterNode> members)
-   {
-      int result = 0;
-      
-      for (ClusterNode member: members)
-      {
-         if (member != null)
-         {
-            result += member.getName().hashCode(); // no explicit overflow with int addition
-         }
-      }
-      
-      return result;
-   }
-   
-   protected int updateReplicantsHashId(String key)
-   {
-      // we first get a list of all nodes names that replicate this key
-      //
-      List<ClusterNode> nodes = this.lookupReplicantsNodes(key);
-      int result = 0;
-      
-      if ((nodes == null) || nodes.isEmpty())
-      {
-         // no nore replicants for this key: we uncache our view id
-         //
-         this.intraviewIdCache.remove(key);
-      }
-      else
-      {
-         result = this.calculateReplicantsHash(nodes);
-         this.intraviewIdCache.put(key, new Integer(result));
-      }
-      
-      return result;
-      
-   }
-   
-   ///////////////
-   // DistributedReplicantManager API
-   ///////////////
-   
-   /**
-    * Add a replicant to the replicants map.
-    * @param key replicant key name
-    * @param nodeName name of the node that adds this replicant
-    * @param replicant Serialized representation of the replica
-    * @return true, if this replicant was newly added to the map, false otherwise
-    */
-   protected boolean addReplicant(String key, String nodeName, Serializable replicant)
-   {
-      ConcurrentMap<String, Serializable> map = new ConcurrentHashMap<String, Serializable>();
-      
-      ConcurrentMap<String, Serializable> existingMap = this.replicants.putIfAbsent(key, map);
-      
-      return (((existingMap != null) ? existingMap : map).put(nodeName, replicant) != null);
-   }
-   
-   /**
-    * Notifies, through a callback, the listeners for a given replicant that the set of replicants has changed
-    * @param key The replicant key name
-    * @param newReplicants The new list of replicants
-    * @param merge is the notification the result of a cluster merge?
-    * 
-    */
-   protected void notifyKeyListeners(String key, List<Serializable> newReplicants, boolean merge)
-   {
-      if (this.log.isTraceEnabled())
-      {
-         this.log.trace("notifyKeyListeners");
-      }
-
-      // we first update the intra-view id for this particular key
-      //
-      int newId = this.updateReplicantsHashId(key);
-      
-      List<ReplicantListener> listeners = this.keyListeners.get(key);
-
-      if (listeners == null)
-      {
-         if (this.log.isTraceEnabled())
-         {
-            this.log.trace("listeners is null");
-         }
-         return;
-      }
-      
-      if (this.log.isTraceEnabled())
-      {
-         this.log.trace("notifying " + listeners.size() + " listeners for key change: " + key);
-      }
-      
-      for (ReplicantListener listener: listeners)
-      {
-         if (listener != null)
-         {
-            listener.replicantsChanged(key, newReplicants, newId, merge);
-         }
-      }
-   }
-
-   protected void republishLocalReplicants()
-   {
-      try
-      {
-         if (this.log.isTraceEnabled())
-         {
-            this.log.trace("Start Re-Publish local replicants in DRM");
-         }
-
-         for (Map.Entry<String, Serializable> entry: this.localReplicants.entrySet())
-         {
-            Serializable replicant = entry.getValue();
-            
-            if (replicant != null)
-            {
-               String key = entry.getKey();
-               
-               if (this.log.isTraceEnabled())
-               {
-                  this.log.trace("publishing, key=" + key + ", value=" + replicant);
-               }
-
-               Object[] args = { key, this.nodeName, replicant };
-
-               this.partition.callAsynchMethodOnCluster(SERVICE_NAME, "_add", args, add_types, true);
-               
-               this.notifyKeyListeners(key, this.getReplicants(key), false);
-            }
-         }
-         
-         if (this.log.isTraceEnabled())
-         {
-            this.log.trace("End Re-Publish local replicants");
-         }
-      }
-      catch (Exception e)
-      {
-         this.log.error("Re-Publish failed", e);
-      }
-   }
-
-   ////////////////////
-   // Group membership API
-   ////////////////////
-
-   protected void mergeMembers()
-   {
-      try
-      {
-         this.log.debug("Start merging members in DRM service...");
-         
-         List<?> rsp = this.partition.callMethodOnCluster(SERVICE_NAME,
-                                        "lookupLocalReplicants",
-                                        new Object[]{}, new Class[]{}, true);
-         if (rsp.isEmpty())
-         {
-            this.log.debug("No responses from other nodes during the DRM merge process.");
-         }
-         else
-         {
-            this.log.debug("The DRM merge process has received " + rsp.size() + " answers");
-         }
-         
-         // Record keys to be notified, and replicant list per key
-         Map<String, List<Serializable>> notifications = new HashMap<String, List<Serializable>>();
-         
-         // Perform add/remove and replicant lookup atomically
-         synchronized (this.replicants)
-         {
-            for (Object o: rsp)
-            {
-               if (o == null)
-               {
-                  this.log.warn("As part of the answers received during the DRM merge process, a NULL message was received!");
-                  continue;
-               }
-               else if (o instanceof Throwable)
-               {
-                  this.log.warn("As part of the answers received during the DRM merge process, a Throwable was received!", (Throwable) o);
-                  continue;
-               }
-               
-               Object[] objs = (Object[]) o;
-               String node = (String) objs[0];
-               @SuppressWarnings("unchecked")
-               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())
-               {
-                  String key = entry.getKey();
-                  
-                  if (this.addReplicant(key, node, entry.getValue()))
-                  {
-                     notifications.put(key, null);
-                  }
-               }
-               
-               // The merge process needs to remove some (now) unexisting keys
-               for (Map.Entry<String, ConcurrentMap<String, Serializable>> entry: this.replicants.entrySet())
-               {
-                  String key = entry.getKey();
-                  
-                  if (entry.getValue().containsKey(node))
-                  {
-                     if (!replicants.containsKey(key))
-                     {
-                        if (this.removeReplicant(key, node))
-                        {
-                           notifications.put(key, null);
-                        }
-                     }
-                  }
-               }
-            }
-            
-            // Lookup replicants for each changed key
-            for (Map.Entry<String, List<Serializable>> entry: notifications.entrySet())
-            {
-               entry.setValue(this.getReplicants(entry.getKey()));
-            }
-         }
-         
-         // Notify recorded key changes
-         for (Map.Entry<String, List<Serializable>> entry: notifications.entrySet())
-         {
-            this.notifyKeyListeners(entry.getKey(), entry.getValue(), true);
-         }
-
-         this.log.debug("..Finished merging members in DRM service");
-
-      }
-      catch (Exception ex)
-      {
-         this.log.error("merge failed", ex);
-      }
-   }
-
-   /**
-    * Get rid of dead members from replicant list.
-    * 
-    * @param deadMembers the members that are no longer in the view
-    * @param merge       whether the membership change occurred during
-    *                    a cluster merge
-    */
-   protected void purgeDeadMembers(Vector<ClusterNode> deadMembers, boolean merge)
-   {
-      if (deadMembers.isEmpty()) return;
-
-      this.log.debug("purgeDeadMembers, " + deadMembers);
-
-      List<String> deadNodes = new ArrayList<String>(deadMembers.size());
-      
-      for (ClusterNode member: deadMembers)
-      {
-         deadNodes.add(member.getName());
-      }
-      
-      for (Map.Entry<String, ConcurrentMap<String, Serializable>> entry: this.replicants.entrySet())
-      {
-         String key = entry.getKey();
-         ConcurrentMap<String, Serializable> replicant = entry.getValue();
-         
-         List<Serializable> replicants = null;
-         
-         synchronized (this.replicants)
-         {
-            if (replicant.keySet().removeAll(deadNodes))
-            {
-               replicants = this.getReplicants(key);
-            }
-         }
-         
-         if (replicants != null)
-         {
-            this.notifyKeyListeners(key, replicants, merge);
-         }
-      }
-   }
-
-   /**
-    */
-   protected void cleanupKeyListeners()
-   {
-      // NOT IMPLEMENTED YET
-   }
-
-   // Private -------------------------------------------------------
-   
-   // Inner classes -------------------------------------------------
-
-   protected class MergeMembers extends Thread
-   {
-      public MergeMembers()
-      {
-         super("DRM Async Merger#" + threadID.getAndIncrement());
-      }
-
-      /**
-       * Called when the service needs to merge with another partition. This
-       * process is performed asynchronously
-       */
-      public void run()
-      {
-         DistributedReplicantManagerImpl.this.log.debug("Sleeping for 50ms before mergeMembers");
-         try
-         {
-            // if this thread invokes a cluster method call before
-            // membershipChanged event completes, it could timeout/hang
-            // we need to discuss this with Bela.
-            Thread.sleep(50);
-         }
-         catch (InterruptedException e)
-         {
-            Thread.currentThread().interrupt();
-         }
-         DistributedReplicantManagerImpl.this.mergeMembers();
-      }
-   }
-
-   protected class MembersPublisher extends Thread
-   {
-      public MembersPublisher()
-      {
-         super("DRM Async Publisher#" + threadID.getAndIncrement());
-      }
-
-      /**
-       * Called when service needs to re-publish its local replicants to other
-       * cluster members after this node has joined the cluster.
-       */
-      public void run()
-      {
-         DistributedReplicantManagerImpl.this.log.debug("DRM: Sleeping before re-publishing for 50ms just in case");
-         try
-         {
-            // if this thread invokes a cluster method call before
-            // membershipChanged event completes, it could timeout/hang
-            // we need to discuss this with Bela.
-            Thread.sleep(50);
-         }
-         catch (InterruptedException e)
-         {
-            Thread.currentThread().interrupt();
-         }
-         DistributedReplicantManagerImpl.this.republishLocalReplicants();
-      }
-   }
-}

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/DistributedReplicantManagerImplMBean.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/DistributedReplicantManagerImplMBean.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/DistributedReplicantManagerImplMBean.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import org.jboss.ha.framework.interfaces.HAPartition;
-
-/**
- * MBean interface for the Distributed Replicant Manager (DRM) service
- *
- * @author  <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
- * @version $Revision$
- *   
- * <p><b>Revisions:</b>
- *
- * <p><b>12 janvier 2002 Sacha Labourey:</b>
- * <ul>
- * <li> First implementation </li> 
- * </ul>
- */
-
-public interface DistributedReplicantManagerImplMBean
-   extends org.jboss.ha.framework.interfaces.DistributedReplicantManager
-{   
-   /**
-    * Get the {@link HAPartition#getPartitionName() name of the underlying partition}
-    * used by this service.
-    * 
-    * @return the name of the partition
-    */
-   String getPartitionName();
-   
-   String listContent () throws Exception;
-   String listXmlContent () throws Exception;
-}

Modified: trunk/cluster/src/main/java/org/jboss/ha/framework/server/JChannelFactory.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/JChannelFactory.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/JChannelFactory.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -21,61 +21,19 @@
  */
 package org.jboss.ha.framework.server;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.net.URL;
-import java.rmi.dgc.VMID;
-import java.rmi.server.UID;
-import java.security.AccessController;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executor;
 
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.config.ServerConfigUtil;
+import org.jboss.ha.core.channelfactory.ChannelInfo;
+import org.jboss.ha.core.channelfactory.ProtocolStackConfigInfo;
 import org.jboss.ha.framework.server.managed.OpenChannelsMapper;
 import org.jboss.ha.framework.server.managed.ProtocolStackConfigurationsMapper;
-import org.jboss.logging.Logger;
 import org.jboss.managed.api.annotation.ManagementComponent;
 import org.jboss.managed.api.annotation.ManagementObject;
 import org.jboss.managed.api.annotation.ManagementProperties;
 import org.jboss.managed.api.annotation.ManagementProperty;
 import org.jboss.managed.api.annotation.ViewUse;
 import org.jboss.metatype.api.annotations.MetaMapping;
-import org.jboss.system.ServiceMBean;
-import org.jboss.util.loading.ContextClassLoaderSwitcher;
-import org.jgroups.Channel;
-import org.jgroups.ChannelException;
-import org.jgroups.ChannelFactory;
-import org.jgroups.ChannelListenerAdapter;
-import org.jgroups.Global;
-import org.jgroups.JChannel;
-import org.jgroups.conf.ConfiguratorFactory;
-import org.jgroups.conf.ProtocolData;
-import org.jgroups.conf.ProtocolParameter;
-import org.jgroups.conf.ProtocolStackConfigurator;
-import org.jgroups.jmx.JmxConfigurator;
-import org.jgroups.protocols.TP;
-import org.jgroups.stack.Protocol;
-import org.jgroups.stack.ProtocolStack;
-import org.jgroups.util.DefaultThreadFactory;
-import org.jgroups.util.LazyThreadFactory;
-import org.jgroups.util.ThreadDecorator;
-import org.jgroups.util.ThreadFactory;
-import org.jgroups.util.ThreadManager;
-import org.jgroups.util.Util;
-import org.w3c.dom.Element;
 
 /**
  * Implementation of the JGroups <code>ChannelFactory</code> that supports a 
@@ -106,328 +64,12 @@
       properties=ManagementProperties.EXPLICIT,
       isRuntime=true)
 public class JChannelFactory
-      implements ChannelFactory, JChannelFactoryMBean, MBeanRegistration
+      extends org.jboss.ha.core.channelfactory.JChannelFactory
 {
-   private static final Logger log = Logger.getLogger(JChannelFactory.class);
    
-   /** 
-    * Prefix prepended to the protocol stack name to create a synthetic
-    * transport protocol <code>singleton_name</code> value for channels
-    * that don't configure a <code>singleton_name</code>. 
-    */
-   public static final String UNSHARED_TRANSPORT_NAME_BASE = "unnamed_";
-   
-   /** Default value for property {@link #getDomain() domain}. */
-   public static final String DEFAULT_JMX_DOMAIN = "jgroups";
-   
-   private static final int CREATED = ServiceMBean.CREATED;
-   private static final int STARTING = ServiceMBean.STARTING;
-   private static final int STARTED = ServiceMBean.STARTED;
-   private static final int STOPPING = ServiceMBean.STOPPING;
-   private static final int STOPPED = ServiceMBean.STOPPED;
-   private static final int DESTROYED = ServiceMBean.DESTROYED;
-   private static final int FAILED = ServiceMBean.FAILED;
-   
-   private InetAddress nodeAddress;
-   private String nodeName;
-   private int namingServicePort = -1;
-   private int state = ServiceMBean.UNREGISTERED;
-   private boolean assignLogicalAddresses = true;
-   private boolean manageNewThreadClassLoader = true;
-   private boolean manageReleasedThreadClassLoader = false;
-   private boolean addMissingSingletonName = true;
-   private final ContextClassLoaderSwitcher classLoaderSwitcher;
-   private final Map<Channel, ChannelInfo> registeredChannels = 
-      new ConcurrentHashMap<Channel, ChannelInfo>(16, 0.75f, 2);
-   
-   private ChannelCloseListener closeListener = new ChannelCloseListener();
-
-   /**
-    * Map<String,ProtocolStackConfigurator>. Hashmap which maps stack names to JGroups
-    * configurations. Keys are stack names, values are plain JGroups stack
-    * configs. This is (re-)populated whenever a setMultiplexerConfig() method
-    * is called
-    */
-   private final Map<String,ProtocolStackConfigInfo> stacks = 
-      new ConcurrentHashMap<String, ProtocolStackConfigInfo>(16, 0.75f, 2);
-
-   /** 
-    * Placeholder for stacks injected via {@link #setProtocolStackConfigurations(Map)}
-    * until createService is called.
-    */
-   private Map<String,ProtocolStackConfigInfo> injectedStacks;
-   
-   /**
-    * The MBeanServer to expose JMX management data with (no management data
-    * will be available if null)
-    */
-   private MBeanServer server = null;
-
-   /** To expose the channels and protocols */
-   private String domain = DEFAULT_JMX_DOMAIN;
-   private boolean domainSet = false;
-
-   /** Whether or not to expose channels via JMX */
-   private boolean expose_channels=true;
-
-   /** Whether to expose the factory only, or all protocols as well */
-   private boolean expose_protocols=true;
-
-   /**
-    * Creates a new JChannelFactory.
-    */
-   @SuppressWarnings("unchecked")
-   public JChannelFactory()
-   {
-      this.classLoaderSwitcher = (ContextClassLoaderSwitcher) AccessController.doPrivileged(ContextClassLoaderSwitcher.INSTANTIATOR);
-   }   
-
-   /**
-    * Always throws <code>ChannelException</code>; this method is not supported.
-    */   
-   public Channel createChannel() throws ChannelException
-   {
-      throw new ChannelException("No-arg createChannel() is not supported");
-   }
-
-   /**
-    * Creates a channel by passing <code>properties</code> to the 
-    * <code>org.jgroups.JChannel</code> constructor.
-    * 
-    * @param properties protocol stack configuration object; can be <code>null</code>
-    *                   in which case a default stack will be used
-    * 
-    * @return the channel
-    */
-   public Channel createChannel(Object properties) throws ChannelException
-   {
-      checkStarted();
-
-      if (properties == null)
-         properties = JChannel.DEFAULT_PROTOCOL_STACK;
-
-      ProtocolStackConfigurator config = null;
-
-      try
-      {
-         @SuppressWarnings("deprecation")
-         ProtocolStackConfigurator c = ConfiguratorFactory.getStackConfigurator(properties);
-         config = c;
-      }
-      catch (Exception x)
-      {
-         throw new ChannelException("unable to load protocol stack", x);
-      }
-
-      JChannel channel = initializeChannel(config, null, false);
-
-      try
-      {
-         registerChannel(channel, null, null, ProtocolStackUtil.getProtocolData(config));
-      }
-      catch (ChannelException ce)
-      {
-         throw ce;
-      }
-      catch (Exception e)
-      {
-         throw new ChannelException("unable to register channel", e);
-      }
-
-      return channel;
-   }
-
-   /**
-    * Create a {@link Channel} using the specified stack. Channel will use a 
-    * shared transport.
-    * 
-    * @param stack_name 
-    *            The name of the stack to be used. All stacks are defined in
-    *            the configuration with which the factory is configured (see
-    *            {@link #setMultiplexerConfig(Object)} for example. If
-    *            clients attempt to create a Channel for an undefined stack 
-    *            name an exception will be thrown.
-    * 
-    * @return an implementation of Channel configured with a shared transport.
-    * 
-    * @throws IllegalArgumentException if <code>stack_name</code> is 
-    * <code>null</code> or {@link #getConfig(String)} returns <code>null</code>
-    * when <code>stack_name</code> is used.
-    * 
-    * @throws Exception
-    */
-   public Channel createChannel(String stack_name) throws Exception
-   {
-      return createChannelFromRegisteredStack(stack_name, null, false);
-   }
-   
-   /**
-    * Creates and returns a shared transport Channel configured with the specified 
-    * {@link #getConfig(String) protocol stack configuration}.
-    * <p>
-    * <emphasis>NOTE:</emphasis> The implementation of this method is somewhat
-    * different from what is described in 
-    * {@link org.jgroups.ChannelFactory#createMultiplexerChannel(String, String)}.
-    * The returned channel will not be an instance of 
-    * <code>org.jgroups.mux.MuxChannel</code>; rather a channel that uses a
-    * shared transport will be returned.  This will be the case whether or
-    * not the protocol stack specified by <code>stack_name</code> includes
-    * a <code>singleton_name</code> attribute in its 
-    * {@link org.jgroups.protocols.TP transport protocol} configuration. If no 
-    * <code>singleton_name</code> attribute is present, this factory will create
-    * a synthetic one by prepending "unnamed_" to the provided
-    * <code>id</code> param and will use that for the returned channel's 
-    * transport protocol. (Note this will not effect the protocol stack
-    * configuration named by <code>stack_name</code>; i.e. another request
-    * that passes the same <code>stack_name</code> will not inherit the
-    * synthetic singleton name.) 
-    * 
-    * @param stack_name
-    *            The name of the stack to be used. All stacks are defined in
-    *            the configuration with which the factory is configured (see
-    *            {@link #setMultiplexerConfig(Object)} for example. If
-    *            clients attempt to create a Channel for an undefined stack 
-    *            name an Exception will be thrown.
-    * @param id  Only used if {@link #isExposeChannels()} returns <code>true</code>,
-    *            in which case, if not <code>null</code>, is used as part of
-    *            the <code>ObjectName</code> for the JMX mbeans that represent
-    *            the channel and its protocols. Can be <code>null</code>.
-    *            
-    * @return an implementation of Channel configured with a shared transport.
-    *         
-    * @throws IllegalStateException if the specified protocol stack does not
-    *                               declare a <code>singleton_name</code> and
-    *                               {@link #getAddMissingSingletonName()} returns
-    *                               <code>false</code>.
-    * @throws ChannelException
-    */
-   public Channel createMultiplexerChannel(String stack_name, String id) throws Exception
-   {
-      return createChannelFromRegisteredStack(stack_name, id, true);
-   }  
-   
-   /**
-    * Creates and returns a shared transport Channel configured with the specified 
-    * {@link #getConfig(String) protocol stack configuration}.
-    * 
-    * See {@link #createMultiplexerChannel(String, String)}; the additional
-    * attributes specified in this overloaded version of that method are ignored.
-    *
-    * @param register_for_state_transfer ignored in JBoss AS. Treated as <code>false</code>.
-    * 
-    * @param substate_id ignored in JBoss AS
-    *            
-    * @return An implementation of Channel configured with a shared transport.
-    *         
-    *         
-    * @throws IllegalStateException if the specified protocol stack does not
-    *                               declare a <code>singleton_name</code> and
-    *                               {@link #getAddMissingSingletonName()} returns
-    *                               <code>false</code>.
-    * @throws ChannelException
-    */
-   public Channel createMultiplexerChannel(String stack_name, String id, boolean register_for_state_transfer, String substate_id) throws Exception
-   {
-      return createMultiplexerChannel(stack_name, id);
-   }
-   
-   /**
-    * {@link #parse(Element) Parses <code>properties</code>} and then adds
-    * the resulting protocol stack configurations to the set available for use.
-    * Same as 
-    * {@link #setMultiplexerConfig(Element, boolean) <code>setMultiplexerConfig(properties, true</code>}.
-    * 
-    * @param properties document root node for XML content in the JGroups 
-    *                   <code>stacks.xml</code> format
-    */
-   public void setMultiplexerConfig(Element properties) throws Exception
-   {
-      setMultiplexerConfig(properties, true);
-   }
-
-   /**
-    * {@link #parse(InputStream) Parses} an input stream created from 
-    * <code>properties</code> and then adds the resulting protocol stack 
-    * configurations to the set available for use. Same as 
-    * {@link #setMultiplexerConfig(File, boolean) <code>setMultiplexerConfig(properties, true</code>}.
-    * 
-    * @param properties file which must contain XML content in the JGroups 
-    *              <code>stacks.xml</code> format
-    */
-   public void setMultiplexerConfig(File properties) throws Exception
-   {
-      setMultiplexerConfig(properties, true);      
-   }
-
-   /**
-    * {@link #parse(InputStream) Parses} an input stream created from 
-    * <code>properties</code> and then adds the resulting protocol stack 
-    * configurations to the set available for use. Same as 
-    * {@link #setMultiplexerConfig(Object, boolean) <code>setMultiplexerConfig(properties, true</code>}.
-    * 
-    * @param properties object that can be {@link ConfiguratorFactory#getConfigStream(Object) converted into a stream}
-    *                   which must contain XML content in the JGroups 
-    *                   <code>stacks.xml</code> format
-    */
-   public void setMultiplexerConfig(Object properties) throws Exception
-   {
-      setMultiplexerConfig(properties, true);
-   }
-
-   /**
-    * {@link #parse(InputStream) Parses} an input stream created from 
-    * <code>properties</code> and then adds the resulting protocol stack 
-    * configurations to the set available for use. Same as 
-    * {@link #setMultiplexerConfig(String, boolean) <code>setMultiplexerConfig(properties, true</code>}.
-    * 
-    * @param properties string that can be {@link ConfiguratorFactory#getConfigStream(String) converted into a stream}
-    *                   which must contain XML content in the JGroups 
-    *                   <code>stacks.xml</code> format
-    */
-   public void setMultiplexerConfig(String properties) throws Exception
-   {
-      setMultiplexerConfig(properties, true);
-   }
-
-   /**
-    * {@link #parse(InputStream) Parses} an input stream created from 
-    * <code>properties</code> and then adds the resulting protocol stack 
-    * configurations to the set available for use. Same as 
-    * {@link #setMultiplexerConfig(URL, boolean) <code>setMultiplexerConfig(properties, true</code>}.
-    * 
-    * @param properties URL which must contain XML content in the JGroups 
-    *              <code>stacks.xml</code> format
-    */
-   public void setMultiplexerConfig(URL properties) throws Exception
-   {
-      setMultiplexerConfig(properties, true);
-   }
-
    // -------------------------------------------------------------  Properties
 
    /**
-    * Gets the MBeanServer to use to register mbeans for channels and protocols
-    * we create.
-    * 
-    * @return the MBeanServer, or <code>null</code> if one isn't registered
-    */
-   public MBeanServer getServer() 
-   {
-       return server;
-   }
-
-   /**
-    * Sets the MBeanServer to use to register mbeans for channels and protocols
-    * we create.
-    * 
-    * @param server the MBeanServer. May be <code>null</code>
-    */
-   public void setServer(MBeanServer server) 
-   {
-       this.server=server;
-   }
-
-   /**
     * Gets the domain portion of the JMX ObjectName to use when registering channels and protocols
     * 
     * @return the domain. Will not return <code>null</code> after {@link #create()}
@@ -436,39 +78,21 @@
    @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The domain portion of the JMX ObjectName to use when registering channels and protocols")
    public String getDomain() 
    {
-       return domain == null ? "jgroups" : domain;
+       return super.getDomain();
    }
-   
-   public void setDomain(String domain)
-   {
-      this.domain = domain;
-      this.domainSet = true;
-   }
 
    @ManagementProperty(use={ViewUse.CONFIGURATION}, description="Whether to expose channels we create via JMX")
    public boolean isExposeChannels() 
    {
-       return expose_channels;
+       return super.isExposeChannels();
    }
 
-   public void setExposeChannels(boolean expose_channels) 
-   {
-       this.expose_channels=expose_channels;
-   }
-
    @ManagementProperty(use={ViewUse.CONFIGURATION}, description="Whether to expose protocols via JMX as well if we expose channels")
    public boolean isExposeProtocols() 
    {
-       return expose_protocols;
+       return super.isExposeProtocols();
    }
 
-   public void setExposeProtocols(boolean expose_protocols) 
-   {      
-       this.expose_protocols=expose_protocols;
-       if (expose_protocols)
-          this.expose_channels=true;
-   }
-
    /**
     * Get any logical name assigned to this server; if not null this value
     * will be the value of the 
@@ -480,79 +104,10 @@
    @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The cluster-unique logical name of this node")
    public String getNodeName()
    {
-      return nodeName;
+      return super.getNodeName();
    }
-
-   /**
-    * Sets the logical name assigned to this server; if not null this value
-    * will be the value of the 
-    * {@link #setAssignLogicalAddresses(boolean) logical address} assigned
-    * to the channels this factory creates.
-    * 
-    * @param nodeName the logical name for this server, or <code>null</code>.
-    */
-   public void setNodeName(String nodeName)
-   {
-      this.nodeName = nodeName;
-   }
    
    /**
-    * Gets the address to which this server is bound; typically the value
-    * passed to <code>-b</code> when JBoss is started. Used in combination 
-    * with {@link #getNamingServicePort() the naming service port} to create
-    * a logical name for this server if no {@link #SetNodeName(String) node name}
-    * is specified.
-    * 
-    * @return the address to which this server is bound, or <code>null</code>
-    *         if not set
-    */
-   public InetAddress getNodeAddress()
-   {
-      return nodeAddress;
-   }
-   
-   /**
-    * Sets the address to which this server is bound; typically the value
-    * passed to <code>-b</code> when JBoss is started. Used in combination 
-    * with {@link #getNamingServicePort() the naming service port} to create
-    * a logical name for this server if no {@link #SetNodeName(String) node name}
-    * is specified.
-    * 
-    * @param nodeAddress the address to which this server is bound, 
-    *                    or <code>null</code>
-    */
-   public void setNodeAddress(InetAddress nodeAddress)
-   {
-      this.nodeAddress = nodeAddress;
-   }
-
-   /**
-    * Gets the port on which this server's naming service is listening. Used in 
-    * combination with {@link #getNodeAddress() the server bind address} to create
-    * a logical name for this server if no {@link #SetNodeName(String) node name}
-    * is specified.
-    * 
-    * @return the port on which JNDI is listening, or <code>-1</code> if not set.
-    */
-   public int getNamingServicePort()
-   {
-      return namingServicePort;
-   }
-
-   /**
-    * Sets the port on which this server's naming service is listening. Used in 
-    * combination with {@link #getNodeAddress() the server bind address} to create
-    * a logical name for this server if no {@link #SetNodeName(String) node name}
-    * is specified.
-    * 
-    * @param jndiPort the port on which JNDI is listening.
-    */
-   public void setNamingServicePort(int jndiPort)
-   {
-      this.namingServicePort = jndiPort;
-   }
-   
-   /**
     * Gets whether this factory should create a "logical address" (or use
     * one set via {@link #setNodeName(String)} and assign it to
     * any newly created <code>Channel</code> as JGroups "additional_data".
@@ -562,30 +117,10 @@
    @ManagementProperty(use={ViewUse.CONFIGURATION}, description="Whether this factory should assign a logical address for this node to all channels")
    public boolean getAssignLogicalAddresses()
    {
-      return assignLogicalAddresses;
+      return super.getAssignLogicalAddresses();
    }
-
+   
    /**
-    * Sets whether this factory should create a "logical address" (or use
-    * one set via {@link #setNodeName(String)} and assign it to
-    * any newly created <code>Channel</code> as JGroups "additional_data".
-    * <p>
-    * Any such logical address will be used by <code>HAPartition</code>
-    * to assign a name to the <code>ClusterNode</code> object representing 
-    * this node. If a logical address is not set, the <code>ClusterNode</code> 
-    * will use the address and port JGroups is using to receive messages to
-    * create its name.
-    * </p>
-    * <p>
-    * Default is <code>true</code>.
-    * </p>
-    */
-   public void setAssignLogicalAddresses(boolean logicalAddresses)
-   {
-      this.assignLogicalAddresses = logicalAddresses;
-   }
-
-   /**
     * Gets whether this factory should update the standard JGroups
     * thread factories to ensure application classloaders do not leak to 
     * newly created channel threads.
@@ -596,23 +131,10 @@
    @ManagementProperty(use={ViewUse.CONFIGURATION}, description="Whether this factory should update the standard JGroups thread factories to ensure classloader leaks do not occur")
    public boolean getManageNewThreadClassLoader()
    {
-      return manageNewThreadClassLoader;
+      return super.getManageNewThreadClassLoader();
    }
 
    /**
-    * Sets whether this factory should update the standard JGroups
-    * thread factories to ensure application classloaders do not leak to 
-    * newly created channel threads. This should only be set to <code>false</code>
-    * if a JGroups release is used that itself prevents such classloader leaks.
-    * 
-    * @param manage <code>true</code> if the factories should be updated.
-    */
-   public void setManageNewThreadClassLoader(boolean manage)
-   {
-      this.manageNewThreadClassLoader = manage;
-   }
-
-   /**
     * Gets whether this factory should update the standard JGroups
     * thread pools to ensure application classloaders have not leaked to 
     * threads returned to the pool.
@@ -623,28 +145,10 @@
    @ManagementProperty(use={ViewUse.CONFIGURATION}, description="Whether this factory should update the standard JGroups thread pools to ensure classloader leaks do not occur")
    public boolean getManageReleasedThreadClassLoader()
    {
-      return manageReleasedThreadClassLoader;
+      return super.getManageReleasedThreadClassLoader();
    }
 
    /**
-    * Sets whether this factory should update the standard JGroups
-    * thread pools to ensure application classloaders have not leaked to 
-    * threads returned to the pool.
-    * <p>
-    * There is a small performance cost to enabling this, and applications
-    * can prevent any need to enable it by properly restoring the thread
-    * context classloader if they change it.  Therefore, by default this
-    * is set to <code>false</code>.
-    * </p>
-    * 
-    * @param manage <code>true</code> if the factories should be updated.
-    */
-   public void setManageReleasedThreadClassLoader(boolean manage)
-   {
-      this.manageReleasedThreadClassLoader = manage;
-   }
-
-   /**
     * Gets whether {@link #createMultiplexerChannel(String, String)} should 
     * create a synthetic singleton name attribute for a channel's transport
     * protocol if one isn't configured.  If this is <code>false</code> and
@@ -659,118 +163,10 @@
          description="Whether this factory should create a synthetic singleton name attribute for a channel's transport protocol if one isn't configured")
    public boolean getAddMissingSingletonName()
    {
-      return addMissingSingletonName;
+      return super.getAddMissingSingletonName();
    }
-
-   /**
-    * Sets whether {@link #createMultiplexerChannel(String, String)} should 
-    * create a synthetic singleton name attribute for a channel's transport
-    * protocol if one isn't configured.
-    * 
-    * @param addMissingSingletonName <code>true</code> if synthetic singleton 
-    *                                names should be created.
-    */
-   public void setAddMissingSingletonName(boolean addMissingSingletonName)
-   {
-      this.addMissingSingletonName = addMissingSingletonName;
-   }
    
    // -------------------------------------------------------------  Public
-
-   /**
-    * {@link #parse(Element) Parses <code>properties</code>} and then adds
-    * the resulting protocol stack configurations to the set available for use.
-    * 
-    * @param properties document root node for XML content in the JGroups 
-    *                   <code>stacks.xml</code> format
-    * @param replace <code>true</code> if a configuration with the same
-    *                stack name as an already registered configuration should
-    *                replace that configuration; <code>false</code> if it
-    *                should be discarded.
-    */
-   public void setMultiplexerConfig(Element properties, boolean replace) throws Exception
-   {
-      Map<String, ProtocolStackConfigInfo> map = ProtocolStackUtil.parse(properties);
-      
-      for (Map.Entry<String, ProtocolStackConfigInfo> entry : map.entrySet())
-      {
-         addConfig(entry.getKey(), entry.getValue(), replace);
-      }
-   }
-
-   /**
-    * {@link #parse(InputStream) Parses} an input stream created from 
-    * <code>properties</code> and then adds the resulting protocol stack 
-    * configurations to the set available for use.
-    * 
-    * @param properties file which must contain XML content in the JGroups 
-    *              <code>stacks.xml</code> format
-    * @param replace <code>true</code> if a configuration with the same
-    *                stack name as an already registered configuration should
-    *                replace that configuration; <code>false</code> if it
-    *                should be discarded.
-    */
-   public void setMultiplexerConfig(File properties, boolean replace) throws Exception
-   {
-      InputStream input=ConfiguratorFactory.getConfigStream(properties);      
-      addConfigs(input, properties.toString(), replace);
-   }
-
-   /**
-    * {@link #parse(InputStream) Parses} an input stream created from 
-    * <code>properties</code> and then adds the resulting protocol stack 
-    * configurations to the set available for use. 
-    * 
-    * @param properties object that can be {@link ConfiguratorFactory#getConfigStream(Object) converted into a stream}
-    *                   which must contain XML content in the JGroups 
-    *                   <code>stacks.xml</code> format
-    * @param replace <code>true</code> if a configuration with the same
-    *                stack name as an already registered configuration should
-    *                replace that configuration; <code>false</code> if it
-    *                should be discarded.
-    */
-   public void setMultiplexerConfig(Object properties, boolean replace) throws Exception
-   {
-      InputStream input=ConfiguratorFactory.getConfigStream(properties);
-      addConfigs(input, properties.toString(), replace);   
-   }
-
-   /**
-    * {@link #parse(InputStream) Parses} an input stream created from 
-    * <code>properties</code> and then adds the resulting protocol stack 
-    * configurations to the set available for use.
-    * 
-    * @param properties string that can be {@link ConfiguratorFactory#getConfigStream(String) converted into a stream}
-    *                   which must contain XML content in the JGroups 
-    *                   <code>stacks.xml</code> format
-    * @param replace <code>true</code> if a configuration with the same
-    *                stack name as an already registered configuration should
-    *                replace that configuration; <code>false</code> if it
-    *                should be discarded.
-    */
-   public void setMultiplexerConfig(String properties, boolean replace) throws Exception
-   {
-      InputStream input=ConfiguratorFactory.getConfigStream(properties);      
-      addConfigs(input, properties, replace);
-   }
-
-   /**
-    * {@link #parse(InputStream) Parses} an input stream created from 
-    * <code>properties</code> and then adds the resulting protocol stack 
-    * configurations to the set available for use.
-    * 
-    * @param properties URL which must contain XML content in the JGroups 
-    *              <code>stacks.xml</code> format
-    * @param replace <code>true</code> if a configuration with the same
-    *                stack name as an already registered configuration should
-    *                replace that configuration; <code>false</code> if it
-    *                should be discarded.
-    */
-   public void setMultiplexerConfig(URL url, boolean replace) throws Exception
-   {
-      InputStream input=ConfiguratorFactory.getConfigStream(url);      
-      addConfigs(input, url.toString(), replace);
-   }
    
 
    // --------------------------------------------------------  Management View
@@ -785,7 +181,7 @@
    @MetaMapping(value=OpenChannelsMapper.class)
    public Set<ChannelInfo> getOpenChannels()
    {
-      return new HashSet<ChannelInfo>(registeredChannels.values());
+      return super.getOpenChannels();
    }
    
    @ManagementProperty(use={ViewUse.CONFIGURATION, ViewUse.RUNTIME}, 
@@ -793,896 +189,15 @@
    @MetaMapping(value=ProtocolStackConfigurationsMapper.class)
    public Map<String, ProtocolStackConfigInfo> getProtocolStackConfigurations()
    {
-      return Collections.unmodifiableMap(stacks);
+      return super.getProtocolStackConfigurations();
    }
-   
-   public void setProtocolStackConfigurations(Map<String, ProtocolStackConfigInfo> configs)
-   {
-      this.injectedStacks = configs;      
-      
-      if (state == STARTED)
-      {
-         // We're already running so this must be a ManagedComponent update
-         // so apply immediately
-         processInjectedStacks();
-      }
-   }
 
    // ---------------------------------------------------  JChannelFactoryMBean
-
-   /**
-    * {@inheritDoc}
-    */
-   public void clearConfigurations()
-   {
-      this.stacks.clear();
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public String dumpChannels()
-   {
-      return "";
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public String dumpConfiguration()
-   {
-      return stacks.keySet().toString();
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public String getConfig(String stack_name) throws Exception
-   {
-      ProtocolStackConfigInfo cfg = stacks.get(stack_name);
-      if (cfg == null)
-         throw new Exception("stack \"" + stack_name + "\" not found in " + stacks.keySet());
-      return cfg.getConfigurator().getProtocolStackString();
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public String getMultiplexerConfig()
-   {
-      StringBuilder sb = new StringBuilder();
-      for (Map.Entry<String, ProtocolStackConfigInfo> entry : stacks.entrySet())
-      {
-         sb.append(entry.getKey()).append(": ").append(entry.getValue().getConfigurator().getProtocolStackString()).append("\n");
-      }
-      return sb.toString();
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   public boolean removeConfig(String stack_name)
-   {
-      return stack_name != null && this.stacks.remove(stack_name) != null;
-   }
    
    // -------------------------------------------------------------  Lifecycle
-
-   /**
-    * {@inheritDoc}
-    * <p>
-    * This method largely directly concerns itself with the {@link #getStateString() state}
-    * field, delegating the real work to {@link #createService()}.
-    * </p>
-    */
-   public void create() throws Exception
-   {
-
-      if (state == CREATED || state == STARTING || state == STARTED
-         || state == STOPPING || state == STOPPED)
-      {
-         log.debug("Ignoring create call; current state is " + getStateString());
-         return;
-      }
-      
-      log.debug("Creating JChannelFactory");
-      
-      try
-      {
-         createService();
-         state = CREATED;
-      }
-      catch (Exception e)
-      {
-         log.debug("Initialization failed JChannelFactory", e);
-         throw e;
-      }
-      
-      log.debug("Created JChannelFactory");
-   }
-
-   /**
-    * {@inheritDoc}
-    * <p>
-    * This method largely directly concerns itself with the {@link #getStateString() state}
-    * field, delegating the real work to {@link #startService()}.
-    * </p>
-    */
-   public void start() throws Exception
-   {
-      if (state == STARTING || state == STARTED || state == STOPPING)
-      {
-         log.debug("Ignoring start call; current state is " + getStateString());
-         return;
-      }
-      
-      if (state != CREATED && state != STOPPED && state != FAILED)
-      {
-         log.debug("Start requested before create, calling create now");         
-         create();
-      }
-      
-      state = STARTING;
-      log.debug("Starting JChannelFactory");
-
-      try
-      {
-         startService();
-      }
-      catch (Exception e)
-      {
-         state = FAILED;
-         log.debug("Starting failed JChannelFactory", e);
-         throw e;
-      }
-
-      state = STARTED;
-      log.debug("Started JChannelFactory");
-      
-   }
-
-   /**
-    * {@inheritDoc}
-    * <p>
-    * This method largely directly concerns itself with the {@link #getStateString() state}
-    * field, delegating the real work to {@link #stopService()}.
-    * </p>
-    */
-   public void stop()
-   {
-      if (state != STARTED)
-      {
-         log.debug("Ignoring stop call; current state is " + getStateString());
-         return;
-      }
-      
-      state = STOPPING;
-      log.debug("Stopping JChannelFactory");
-
-      try
-      {
-         stopService();
-      }
-      catch (Throwable e)
-      {
-         state = FAILED;
-         log.warn("Stopping failed JChannelFactory", e);
-         return;
-      }
-      
-      state = STOPPED;
-      log.debug("Stopped JChannelFactory");
-   }
-
-   /**
-    * {@inheritDoc}
-    * <p>
-    * This method largely directly concerns itself with the {@link #getStateString() state}
-    * field, delegating the real work to {@link #destroyService()}.
-    * </p>
-    */
-   public void destroy()
-   {
-      if (state == DESTROYED)
-      {
-         log.debug("Ignoring destroy call; current state is " + getStateString());
-         return;
-      }
-      
-      if (state == STARTED)
-      {
-         log.debug("Destroy requested before stop, calling stop now");
-         stop();
-      }
-      
-      log.debug("Destroying JChannelFactory");
-      
-      try
-      {         
-         destroyService();
-      }
-      catch (Throwable t)
-      {
-         log.warn("Destroying failed JChannelFactory", t);
-      }
-      state = DESTROYED;
-      log.debug("Destroyed JChannelFactory");
-   }
-
-   // ------------------------------------------------------- MBeanRegistration
-
-   public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
-   {
-      setServer(server);
-      if (!this.domainSet || this.domain == null)
-      {
-         setDomain(name.getDomain());
-      }
-      return name;
-   }
-
-   public void postRegister(Boolean registrationDone)
-   {
-      if (registrationDone != null && registrationDone.booleanValue()
-            && state == ServiceMBean.UNREGISTERED)
-      {
-         state = ServiceMBean.REGISTERED;
-      }
-   }
-
-   public void preDeregister() throws Exception
-   { 
-   }
-
-   public void postDeregister()
-   { 
-      setServer(null);
-      if (state == ServiceMBean.DESTROYED)
-         state = ServiceMBean.UNREGISTERED;
-   }
-
-   // --------------------------------------------------------------- Protected
    
-   /**
-    * Gets the classloader that channel threads should be set to if
-    * {@link #getManageNewThreadClassloader()} or {@link #getManageReleasedThreadClassLoader()}
-    * are <code>true</code>.
-    * <p>
-    * This implementation returns this class' classloader.
-    * 
-    * @return the classloader.
-    */
-   protected ClassLoader getDefaultChannelThreadContextClassLoader()
-   {
-      return getClass().getClassLoader();
-   }
+   // --------------------------------------------------------------- Protected
 
-   protected void createService() throws Exception
-   {
-      if(expose_channels) 
-      {
-         if(server == null)
-         {
-            throw new Exception("No MBeanServer found; JChannelFactory needs to " +
-            		"be run with an MBeanServer present, or with ExposeChannels " +
-            		"set to false");
-         }
-         
-         if(domain == null)
-         {
-            domain= DEFAULT_JMX_DOMAIN;
-         }
-      }
-   }
-
-   /**
-    * The actual startup work.
-    * 
-    * @throws Exception
-    */
-   protected void startService() throws Exception
-   {
-      // If the ProfileService injected stacks, process them now
-      processInjectedStacks();
-   }
-
-   /**
-    * The actual service stop work. This base implementation does nothing.
-    * 
-    * @throws Exception
-    */
-   protected void stopService() throws Exception
-   {
-      // no-op
-   }
-
-   /**
-    * The actual service destruction work.
-    *
-    */
-   protected void destroyService()
-   {  
-      for (Channel ch : registeredChannels.keySet())
-      {
-         unregisterChannel(ch);
-      }
-   }
-
    // ----------------------------------------------------------------- Private
-
-
-   private void checkStarted()
-   {
-      if (state != ServiceMBean.STARTED)
-         throw new IllegalStateException("Cannot use factory; state is " + getStateString());
-   }
    
-   private void addConfigs(InputStream input, String source, boolean replace) throws Exception
-   {
-      if(input == null)
-      {
-         throw new FileNotFoundException(source);
-      }
-      
-      Map<String, ProtocolStackConfigInfo> map = null;
-      try 
-      {
-          map = ProtocolStackUtil.parse(input);
-      }
-      catch(Exception ex) 
-      {
-          throw new Exception("failed parsing " + source, ex);
-      }
-      finally 
-      {
-          Util.close(input);
-      }
-      
-      for (Map.Entry<String, ProtocolStackConfigInfo> entry : map.entrySet())
-      {
-         addConfig(entry.getKey(), entry.getValue(), replace);
-      }
-   }
-
-   private boolean addConfig(String st_name, ProtocolStackConfigInfo val, boolean replace)
-   {
-      boolean added = replace;
-      if (replace)
-      {
-         stacks.put(st_name, val);
-         if (log.isTraceEnabled())
-            log.trace("added config '" + st_name + "'");
-      }
-      else
-      {
-         if (!stacks.containsKey(st_name))
-         {
-            stacks.put(st_name, val);
-            if (log.isTraceEnabled())
-               log.trace("added config '" + st_name + "'");
-            added = true;
-         }
-         else
-         {
-            if (log.isTraceEnabled())
-               log.trace("didn't add config '" + st_name + " because one of the same name already existed");
-         }
-      }
-      return added;      
-   }
-   
-   private synchronized void processInjectedStacks()
-   {
-      if (injectedStacks != null)
-      {
-         clearConfigurations();
-         stacks.putAll(injectedStacks);
-         injectedStacks = null;
-      }      
-   }
-
-   /**
-    * Creates a channel from one of the known stack configurations.
-    * 
-    * @param stack_name the name of the stack config
-    * @param id optional id for the channel
-    * @param forceSingletonStack <code>true</code> if a singleton_name must be
-    *             either configured, or addMissingSingletonName must be true
-    *             
-    * @return the channel
-    * 
-    * @throws IllegalArgumentException if stack_name is unknown
-    * @throws IllegalStateException if forceSingletonStack is <code>true</code>
-    *                               but a singleton_name couldn't be configured
-    *           
-    * @throws Exception
-    */
-   private Channel createChannelFromRegisteredStack(String stack_name, String id, boolean forceSingletonStack) throws Exception
-   {
-      checkStarted();
-      
-      ProtocolStackConfigInfo config = stacks.get(stack_name);
-      
-      if (config == null)
-         throw new IllegalArgumentException("Unknown stack_name " + stack_name);
-      
-      JChannel channel = initializeChannel(config.getConfigurator(), stack_name, forceSingletonStack);
-      
-      registerChannel(channel, id, stack_name, ProtocolStackUtil.getProtocolData(config.getConfigurator()));      
-      
-      return channel;
-   }
-
-   /**
-    * Construct a JChannel from the given config and then do post-construction
-    * processing like fixing up thread managment or setting a unique id.
-    * 
-    * @param config the config
-    * 
-    * @return the channel
-    * 
-    * @throws ChannelException
-    */
-   private JChannel initializeChannel(ProtocolStackConfigurator config, String stack_name,
-         boolean forceSingletonStack) throws ChannelException
-   {  
-      Map<String, String> tpProps = getTransportProperties(config);
-   
-      if (!tpProps.containsKey(Global.SINGLETON_NAME))
-      {
-         if (addMissingSingletonName && stack_name != null)
-         {
-            String singletonName = UNSHARED_TRANSPORT_NAME_BASE + stack_name;
-            
-            log.warn("Config for " + stack_name + " does not include " +
-                      "singleton_name; adding a name of " + singletonName +
-                      ". You should configure a singleton_name for this stack.");
-            
-            config = addSingletonName(config, singletonName);
-            log.debug("Stack config after adding singleton_name is " + config.getProtocolStackString());
-            tpProps = getTransportProperties(config);                       
-         }
-         else if (forceSingletonStack)
-         {
-            throw new IllegalStateException("Config for " + stack_name + " does not include " +
-                      "singleton_name and MuxChannels are not supported.");
-         }
-      }
-      JChannel channel = new JChannel(config);
-      
-      if (manageNewThreadClassLoader || manageReleasedThreadClassLoader)
-      {
-         fixChannelThreadManagement(channel);
-      }
-      
-      if (assignLogicalAddresses)
-      {
-         setChannelUniqueId(channel);
-      }
-      
-      return channel;
-   }
-   
-   /**
-    * Gets the current runtime lifecycle state (e.g. CREATED, STARTED).
-    */
-   private String getStateString()
-   {
-      return ServiceMBean.states[state];
-   }
-   
-   private void setChannelUniqueId(Channel channel)
-   {
-      String logical_address_name = channel.getName();
-      if (logical_address_name == null)
-      {
-         // We push the independent name in the protocol stack before connecting to the cluster
-         if (this.nodeName == null || "".equals(this.nodeName)) {
-            this.nodeName = generateUniqueNodeName();
-         }
-         
-         log.debug("Assigning unique node id " + nodeName + " to the channel");
-         
-         channel.setName(this.nodeName);        
-      }    
-   }
-
-   private synchronized String generateUniqueNodeName ()
-   {
-      // we first try to find a simple meaningful name:
-      // 1st) "local-IP:JNDI_PORT" if JNDI is running on this machine
-      // 2nd) "local-IP:JMV_GUID" otherwise
-      // 3rd) return a fully GUID-based representation
-      //
-
-      // Before anything we determine the local host IP (and NOT name as this could be
-      // resolved differently by other nodes...)
-
-      // But use the specified node address for multi-homing
-
-      String hostIP = null;
-      InetAddress address = ServerConfigUtil.fixRemoteAddress(nodeAddress);
-      if (address == null)
-      {
-         log.debug ("unable to create a GUID for this cluster, check network configuration is correctly setup (getLocalHost has returned an exception)");
-         log.debug ("using a full GUID strategy");
-         return new VMID().toString();
-      }
-      else
-      {
-         hostIP = address.getHostAddress();
-      }
-
-      // 1st: is JNDI up and running?
-      //
-      if (namingServicePort > 0)
-      {
-         // we can proceed with the JNDI trick!
-         return hostIP + ":" + namingServicePort;
-      }
-      else
-      {
-         log.warn("JNDI has been found but the service wasn't started. Most likely, " +
-         		    "HAPartition bean is missing dependency on JBoss Naming. " +
-         		    "Instead using host based UID strategy for defining a node " +
-         		    "GUID for the cluster.");
-      }
-
-      // 2nd: host-GUID strategy
-      //
-      String uid = new UID().toString();
-      return hostIP + ":" + uid;
-   }
-   
-   private Map<String, String> getTransportProperties(ProtocolStackConfigurator config)
-   {
-      Map<String, String> tpProps = null;
-      ProtocolData[] protocols= ProtocolStackUtil.getProtocolData(config);
-      ProtocolData transport=protocols[0];
-      @SuppressWarnings("unchecked")
-      Map<String,ProtocolParameter> tmp=transport.getParameters();
-      tpProps = new HashMap<String,String>();
-      for(Map.Entry<String,ProtocolParameter> entry: tmp.entrySet())
-      {
-          tpProps.put(entry.getKey(), entry.getValue().getValue());
-      }
-      
-      return tpProps;
-   }
-  
-   private ProtocolStackConfigurator addSingletonName(ProtocolStackConfigurator orig, String singletonName)
-      throws ChannelException
-   {
-      ProtocolStackConfigurator result = null;
-      try
-      {
-         ProtocolData[] protocols=orig.getProtocolStack();
-         ProtocolData transport=protocols[0];
-         ProtocolParameter singletonParam = new ProtocolParameter(Global.SINGLETON_NAME, singletonName);
-         transport.override(new ProtocolParameter[]{ singletonParam});
-         result = orig;
-      }
-      catch (UnsupportedOperationException uoe)
-      {
-         // JGroups version hasn't implemented ProtocolStackConfigurator.getProtocolStack()
-         // So we do things manually via string manipulation         
-         String config = orig.getProtocolStackString();
-         int idx = config.indexOf('(') + 1;
-         StringBuilder builder = new StringBuilder(config.substring(0, idx));
-         builder.append(Global.SINGLETON_NAME);
-         builder.append('=');
-         builder.append(singletonName);
-         builder.append(';');
-         builder.append(config.substring(idx));
-         
-         result = ConfiguratorFactory.getStackConfigurator(builder.toString());
-      }
-      
-      return result;
-   }
-   
-   private void fixChannelThreadManagement(Channel channel) throws ChannelException
-   {
-      if (!(channel instanceof JChannel))
-      {
-         log.debug("Cannot fix thread pools for unknown Channel type " + channel.getClass().getName());
-         return;
-      }
-      
-      JChannel jchannel = (JChannel) channel;
-      
-      ProtocolStack stack = jchannel.getProtocolStack();
-      List<Protocol> protocols = stack.getProtocols();
-      TP tp = null;
-      for (int i = protocols.size() - 1; i >= 0; i--)
-      {
-         if (protocols.get(i) instanceof TP)
-         {
-            tp = (TP) protocols.get(i);
-            break;
-         }
-      }
-      
-      ClassLoader defaultTCCL = getDefaultChannelThreadContextClassLoader();
-      ThreadDecoratorImpl threadDecorator = new ThreadDecoratorImpl(defaultTCCL);
-      if (manageNewThreadClassLoader)
-      {
-         fixProtocolThreadFactories(tp, threadDecorator);
-      }
-      
-      if (manageReleasedThreadClassLoader)
-      {
-         fixTransportThreadPools(tp, threadDecorator);
-      }
-   }
-
-   private void fixProtocolThreadFactories(TP tp, ThreadDecoratorImpl threadDecorator)
-   {
-      ThreadFactory stackFactory = tp.getThreadFactory();
-      if (stackFactory == null)
-      {
-         stackFactory = new DefaultThreadFactory(Util.getGlobalThreadGroup(), "", false);
-         tp.setThreadFactory(stackFactory);
-      }
-      fixThreadManager(stackFactory, threadDecorator, "TP.getThreadFactory()");
-      
-      log.debug("Fixed thread factory for " + tp);
-      
-      ThreadFactory timerFactory = tp.getTimerThreadFactory();
-      if (timerFactory == null)
-      {
-         timerFactory = new LazyThreadFactory(Util.getGlobalThreadGroup(), "Timer", true, true);
-         tp.setTimerThreadFactory(timerFactory);            
-      }
-      fixThreadManager(timerFactory, threadDecorator, "TP.getTimerThreadFactory()");
-      
-      log.debug("Fixed timer thread factory for " + tp);
-      
-      ThreadGroup pool_thread_group = null;
-      if (tp.isDefaulThreadPoolEnabled())
-      {
-         ThreadFactory defaultPoolFactory = tp.getDefaultThreadPoolThreadFactory();
-         if (defaultPoolFactory == null)
-         {
-            pool_thread_group=new ThreadGroup(Util.getGlobalThreadGroup(), "Thread Pools");
-            defaultPoolFactory = new DefaultThreadFactory(pool_thread_group, "Incoming", false, true);
-            tp.setThreadFactory(defaultPoolFactory);
-         }
-         fixThreadManager(defaultPoolFactory, threadDecorator, "TP.getDefaultThreadPoolThreadFactory()");
-         
-         log.debug("Fixed default pool thread factory for " + tp);
-      }
-      
-      if (tp.isOOBThreadPoolEnabled())
-      {
-         ThreadFactory oobPoolFactory = tp.getOOBThreadPoolThreadFactory();
-         if (oobPoolFactory == null)
-         {
-            if (pool_thread_group == null)
-               pool_thread_group=new ThreadGroup(Util.getGlobalThreadGroup(), "Thread Pools");
-            oobPoolFactory = new DefaultThreadFactory(pool_thread_group, "OOB", false, true);
-            tp.setThreadFactory(oobPoolFactory);
-         }
-         fixThreadManager(oobPoolFactory, threadDecorator, "TP.getOOBThreadPoolThreadFactory()");
-         
-         log.debug("Fixed oob pool thread factory for " + tp);
-      }
-      
-      Map<ThreadFactory, Protocol> factories= new HashMap<ThreadFactory, Protocol>();
-      Protocol tmp=tp.getUpProtocol();
-      while(tmp != null) {
-        ThreadFactory f=tmp.getThreadFactory();
-         if(f != null && !factories.containsKey(f))
-         {
-            factories.put(f, tmp);
-         }
-         tmp=tmp.getUpProtocol();
-      }
-      
-      for (Map.Entry<ThreadFactory, Protocol> entry : factories.entrySet())
-      {
-         fixThreadManager(entry.getKey(), threadDecorator, entry.getValue().getClass().getSimpleName() + ".getThreadFactory()");
-      }
-      
-      log.debug("Fixed Protocol thread factories");
-   }
-
-   private void fixTransportThreadPools(TP tp, ThreadDecoratorImpl threadDecorator)
-   {
-      Executor threadPool = tp.getDefaultThreadPool();
-      if (tp.isDefaulThreadPoolEnabled())
-      {
-         fixThreadManager(threadPool, threadDecorator, "TP.getDefaultThreadPool()");
-         
-         log.debug("Fixed default thread pool for " + tp);
-      }
-      
-      threadPool = tp.getOOBThreadPool();
-      if (tp.isOOBThreadPoolEnabled())
-      {
-         fixThreadManager(threadPool, threadDecorator, "TP.getOOBThreadPool()"); 
-         
-         log.debug("Fixed OOB thread pool for " + tp);
-      }
-   }
-   
-   private void fixThreadManager(Object manager, ThreadDecoratorImpl decorator, String managerSource)
-   {
-      if (manager instanceof ThreadManager)
-      {
-         ThreadManager threadManager = (ThreadManager) manager;
-         
-         ThreadDecorator existing = threadManager.getThreadDecorator();
-         if (existing instanceof ThreadDecoratorImpl)
-         {
-            // already been handled
-            return;
-         }
-         else if (existing != null)
-         {
-            // someone else has added one; integrate with it
-            decorator.setParent(existing);
-         }
-         threadManager.setThreadDecorator(decorator);
-      }
-      else
-      {
-         log.warn(managerSource + " is not a ThreadManager");
-      }
-   }
-   
-   /** 
-    * Sets the context class loader on <code>thread</code> to the classloader
-    * in effect when this factory was instantiated.
-    * 
-    * @param thread the thread to set
-    */
-   private void setDefaultThreadContextClassLoader(Thread thread, ClassLoader classLoader)
-   {
-      classLoaderSwitcher.setContextClassLoader(thread, classLoader);
-   }
-   
-   private void registerChannel(JChannel ch, String channelId, String stackName, ProtocolData[] config) throws Exception
-   {
-      // Register for channel closed notification so we can unregister
-      ch.addChannelListener(closeListener);
-      
-      ObjectName chName = null;
-      List<ObjectName> protNames = null;
-      List<ObjectName> allNames = registerInJmx(ch, channelId);
-      if (allNames != null && allNames.size() > 0)
-      {
-         chName = allNames.get(0);
-         if (allNames.size() > 1)
-         {
-            protNames = allNames.subList(1, allNames.size());
-         }
-      }
-      
-      ChannelInfo info = new ChannelInfo(channelId, stackName, ch, config, chName, protNames);
-      registeredChannels.put(ch, info);
-   }
-   
-   private List<ObjectName> registerInJmx(JChannel ch, String channelId) throws Exception 
-   {
-      List<ObjectName> allNames = null;
-      
-      if(isExposeChannels() && getServer() != null && channelId != null && channelId.length() > 0)
-      {
-         allNames = new ArrayList<ObjectName>();
-         ObjectName channelName = new ObjectName(getDomain() + ":type=channel,cluster=" + channelId);
-         JmxConfigurator conf = new JmxConfigurator();
-         getServer().registerMBean(conf.asDynamicMBean(ch), channelName);
-         allNames.add(channelName);
-         if (isExposeProtocols())
-         {
-            String baseName = getDomain() + ":type=protocol,cluster=" + channelId;
-            ProtocolStack stack=ch.getProtocolStack();
-            List<Protocol> protocols=stack.getProtocols();
-            
-            for(Protocol prot : protocols)
-            {                                
-                ObjectName prot_name=new ObjectName(baseName + ",protocol=" + prot.getName());
-                server.registerMBean(conf.asDynamicMBean(prot), prot_name);
-                allNames.add(prot_name);
-            }
-         }
-      }
-      
-      return allNames;
-   }
-   
-   private void unregisterChannel(Channel ch)
-   {
-      ChannelInfo info = registeredChannels.remove(ch);
-      if (info == null)
-      {
-         log.warn("Unknown channel " + ch.getClusterName());
-      }
-      else
-      {
-         unregisterFromJmx(info);
-      }
-      
-      ch.removeChannelListener(closeListener);
-   }
-   
-   private void unregisterFromJmx(ChannelInfo info) 
-   {
-      ObjectName oname = info.getChannelObjectName();
-      MBeanServer mbs = getServer();
-      if(info != null && mbs != null)
-      {
-         try
-         {
-            mbs.unregisterMBean(oname);
-         }
-         catch(Exception e)
-         {
-            log.error("failed unregistering " + oname, e);
-         }
-         
-         List<ObjectName> onames = info.getProtocolObjectNames();
-         if (onames != null)
-         {
-            for (ObjectName protName : onames)
-            {
-               try
-               {
-                  mbs.unregisterMBean(protName);
-               }
-               catch(Exception e)
-               {
-                  log.error("failed unregistering " + protName, e);
-               }
-               
-            }
-         }
-      }
-   }
-   
-   private class ThreadDecoratorImpl implements ThreadDecorator
-   {
-      private final ClassLoader classloader;
-      private ThreadDecorator parent;
-      
-      private ThreadDecoratorImpl(ClassLoader classloader)
-      {
-         this.classloader = classloader;
-      }
-
-      public void threadCreated(Thread thread)
-      {
-         if (parent != null)
-            parent.threadCreated(thread);
-         setDefaultThreadContextClassLoader(thread, classloader);
-      }
-
-      public void threadReleased(Thread thread)
-      {
-         if (parent != null)
-            parent.threadCreated(thread);
-         setDefaultThreadContextClassLoader(thread, classloader);
-      }
-
-      public ThreadDecorator getParent()
-      {
-         return parent;
-      }
-
-      public void setParent(ThreadDecorator parent)
-      {
-         this.parent = parent;
-      }
-      
-   }
-
-   private class ChannelCloseListener extends ChannelListenerAdapter
-   {
-      public void channelClosed(Channel channel) 
-      {
-         unregisterChannel(channel);
-      }            
-   }
-   
 }

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/JChannelFactoryMBean.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/JChannelFactoryMBean.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/JChannelFactoryMBean.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,266 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import javax.management.ObjectName;
-
-import org.jgroups.Channel;
-import org.jgroups.ChannelException;
-
-/**
- * StandardMBean interface for {@link JChannelFactory}.
- * <p>
- * The plain-old-java-interface for the channel factory is 
- * <code>org.jgroups.ChannelFactory</code>; users are encouraged to dependency
- * inject a <code>org.jgroups.ChannelFactory</code>.
- * 
- * 
- * @author Bela Ban
- * @author Brian Stansberry
- * 
- * @version $Revision$
- */
-public interface JChannelFactoryMBean 
-{   
-   /**
-    * Returns all configurations as a string
-    */
-   String getMultiplexerConfig();
-   
-   /**
-    * Instructs JGroups to load a set of XML protocol stack configurations.
-    * Same as {@link #setMultiplexerConfig(String, boolean) setMultiplexerConfig(properties, true)}. 
-    * 
-    * @param properties a string representing a system resource containing a
-    *                   JGroups XML configuration, a string representing a URL
-    *                   pointing to a JGroups XML configuration, or a string
-    *                   representing a file name that contains a JGroups XML
-    *                   configuration.
-    *                   
-    * @throws Exception
-    */
-   void setMultiplexerConfig(String properties) throws Exception;
-   
-   /**
-    * Instructs JGroups to load a set of XML protocol stack configurations.
-    * 
-    * @param properties a string representing a system resource containing a
-    *                   JGroups XML configuration, a string representing a URL
-    *                   pointing to a JGroups XML configuration, or a string
-    *                   representing a file name that contains a JGroups XML
-    *                   configuration.
-    * @param replace    <code>true</code> if any protocol stack configuration
-    *                   in <code>properties</code> that has the same name
-    *                   as an existing configuration should replace that
-    *                   existing configuration; <code>false</code> if the
-    *                   existing configuration should take precedence.
-    * 
-    * @throws Exception
-    */
-   void setMultiplexerConfig(String properties, boolean replace) throws Exception;
-
-   /**
-    * Gets the domain portion of any {@link ObjectName} the factory should
-    * use when registering channels or protocols in JMX.
-    * 
-    * @return the domain portion of the object name, or <code>null</code>.
-    */
-   String getDomain();
-   
-   /**
-    * Sets the domain portion of any {@link ObjectName} the factory should
-    * use when registering channels or protocols in JMX.
-    * 
-    * @param name the domain portion of the object name. Must conform to
-    *             the rules for elements in an ObjectName.
-    */
-   void setDomain(String name);
-
-   /**
-    * Gets whether this factory should register channels it creates in JMX.
-    * 
-    * @return <code>true</code> if channels should be registered, 
-    *         <code>false</code> if not
-    */
-   boolean isExposeChannels();
-  
-   /**
-    * Sets whether this factory should register channels it creates in JMX.
-    * 
-    * @param flag <code>true</code> if channels should be registered, 
-    *             <code>false</code> if not
-    */
-   void setExposeChannels(boolean flag);
-
-   /**
-    * Gets whether this factory should register protocols it creates in JMX.
-    * 
-    * @return <code>true</code> if protocols should be registered, 
-    *         <code>false</code> if not
-    */
-   boolean isExposeProtocols();
-   
-   /**
-    * Sets whether this factory should register protocols it creates in JMX.
-    * 
-    * @param flag <code>true</code> if protocols should be registered, 
-    *             <code>false</code> if not
-    */
-   void setExposeProtocols(boolean f);
-
-   /**
-    * Returns the stack configuration as a string (valid to be fed into new JChannel(String)). Throws an exception
-    * if the stack_name is not found. One of the setMultiplexerConfig() methods had to be called beforehand.
-    * 
-    * @return The protocol stack config as a plain string
-    */
-   String getConfig(String stack_name) throws Exception;
-   
-   /**
-    * Removes the given stack from the configuration.
-    * 
-    * @param stack_name the name of the stack
-    * @return <code>true</code> if the stack was removed; <code>false</code> if
-    *         it wasn't registered
-    */
-   boolean removeConfig(String stack_name);
-   
-   /** Removes all protocol stack configurations */
-   void clearConfigurations();
-
-   /**
-    * Create a {@link Channel} using the specified stack. Channel will use a 
-    * shared transport.
-    * 
-    * @param stack_name 
-    *            The name of the stack to be used. All stacks are defined in
-    *            the configuration with which the factory is configured (see
-    *            {@link #setMultiplexerConfig(Object)} for example. If
-    *            clients attempt to create a Channel for an undefined stack 
-    *            name an exception will be thrown.
-    * 
-    * @return an implementation of Channel configured with a shared transport.
-    * 
-    * @throws IllegalArgumentException if <code>stack_name</code> is 
-    * <code>null</code> or {@link #getConfig(String)} returns <code>null</code>
-    * when <code>stack_name</code> is used.
-    * 
-    * @throws Exception
-    */
-   Channel createChannel(String stack_name) throws Exception;
-    
-   /**
-    * Creates and returns a shared transport Channel configured with the specified 
-    * {@link #getConfig(String) protocol stack configuration}.
-    * <p>
-    * <emphasis>NOTE:</emphasis> The implementation of this method is somewhat
-    * different from what is described in 
-    * {@link org.jgroups.ChannelFactory#createMultiplexerChannel(String, String)}.
-    * The returned channel will not be an instance of 
-    * <code>org.jgroups.mux.MuxChannel</code>; rather a channel that uses a
-    * shared transport will be returned.  This will be the case whether or
-    * not the protocol stack specified by <code>stack_name</code> includes
-    * a <code>singleton_name</code> attribute in its 
-    * {@link org.jgroups.protocols.TP transport protocol} configuration. If no 
-    * <code>singleton_name</code> attribute is present, this factory will create
-    * a synthetic one by prepending "unnamed_" to the provided
-    * <code>id</code> param and will use that for the returned channel's 
-    * transport protocol. (Note this will not effect the protocol stack
-    * configuration named by <code>stack_name</code>; i.e. another request
-    * that passes the same <code>stack_name</code> will not inherit the
-    * synthetic singleton name.) 
-    * 
-    * @param stack_name
-    *            The name of the stack to be used. All stacks are defined in
-    *            the configuration with which the factory is configured (see
-    *            {@link #setMultiplexerConfig(Object)} for example. If
-    *            clients attempt to create a Channel for an undefined stack 
-    *            name an Exception will be thrown.
-    * @param id  Only used if the transport protocol configuration for the
-    *            specified stack does not include the <code>singleton_name</code>
-    *            attribute; then it is used to create a synthetic singleton-name
-    *            for the channel's protocol stack.
-    *            
-    * @return An implementation of Channel configured with a shared transport.
-    *         
-    * @throws ChannelException
-    */
-   Channel createMultiplexerChannel(String stack_name, String id) throws Exception;
-   
-   
-   /**
-    * Creates and returns a shared transport Channel configured with the specified 
-    * {@link #getConfig(String) protocol stack configuration}.
-    * 
-    * See {@link #createMultiplexerChannel(String, String)}; the additional
-    * attributes specified in this overloaded version of that method are ignored.
-    *
-    * @param register_for_state_transfer ignored in JBoss AS. Treated as <code>false</code>.
-    * 
-    * @param substate_id ignored in JBoss AS
-    *            
-    * @return An implementation of Channel configured with a shared transport.
-    *         
-    * @throws ChannelException
-    */
-   Channel createMultiplexerChannel(String stack_name, String id, boolean register_for_state_transfer, String substate_id) throws Exception;
-   
-   /**
-    * Execute the create phase of the 4 step lifecycle.
-    * 
-    * @throws Exception
-    */
-   void create() throws Exception;
-   
-   /**
-    * Execute the start phase of the 4 step lifecycle.
-    * 
-    * @throws Exception
-    */
-   void start() throws Exception;
-   
-   /**
-    * Execute the stop phase of the 4 step lifecycle.
-    * 
-    * @throws Exception
-    */
-   void stop();
-   
-   /**
-    * Execute the destroy phase of the 4 step lifecycle.
-    * 
-    * @throws Exception
-    */
-   void destroy();
-    
-   /**
-    * Returns the names of the currently registered protocol stack configurations.
-    */
-   String dumpConfiguration();
-   
-   /**
-    * Dumps the names of any currently running multiplexer channels along with
-    * the id's of any services that are using them.  Information about
-    * currently running non-multiplexer channels are not returned.
-    */
-   String dumpChannels();
-}

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/ProtocolStackConfigInfo.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/ProtocolStackConfigInfo.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/ProtocolStackConfigInfo.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import org.jgroups.conf.ProtocolData;
-import org.jgroups.conf.ProtocolStackConfigurator;
-
-/**
- *
- *
- * @author Brian Stansberry
- * 
- * @version $Revision: $
- */
-public class ProtocolStackConfigInfo
-{
-   private final String name;
-   private final String description;
-   private final ProtocolStackConfigurator configurator;
-   
-   public ProtocolStackConfigInfo(String name, String description, ProtocolStackConfigurator configurator)
-   {
-      if (name == null)
-      {
-         throw new IllegalArgumentException("null name");
-      }
-      if (configurator == null)
-      {
-         throw new IllegalArgumentException("null configurator");
-      }
-      this.name = name;
-      this.description = description;
-      this.configurator = configurator;
-   }
-
-   public String getName()
-   {
-      return name;
-   }
-
-   public String getDescription()
-   {
-      return description;
-   }
-
-   ProtocolStackConfigurator getConfigurator()
-   {
-      return configurator;
-   }
-
-   public ProtocolData[] getConfiguration()
-   {
-      return ProtocolStackUtil.getProtocolData(configurator);
-   }
-}

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/ProtocolStackUtil.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/ProtocolStackUtil.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/ProtocolStackUtil.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,217 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.jboss.logging.Logger;
-import org.jgroups.conf.ConfiguratorFactory;
-import org.jgroups.conf.ProtocolData;
-import org.jgroups.conf.ProtocolParameter;
-import org.jgroups.conf.ProtocolStackConfigurator;
-import org.jgroups.conf.XmlConfigurator;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Utilities related to JGroups protocol stack manipulation.
- *
- * @author Brian Stansberry
- * 
- * @version $Revision: $
- */
-public final class ProtocolStackUtil
-{  
-   private static final Logger log = Logger.getLogger(ProtocolStackUtil.class);
-   
-   private static final String PROTOCOL_STACKS="protocol_stacks";
-   private static final String STACK="stack";
-   private static final String NAME="name";
-   private static final String DESCR="description";
-   private static final String CONFIG="config";
-
-   /**
-    * Parses the contents of <code>input</code> into a map of the
-    * protocol stack configurations contained in the XML.
-    * 
-    * @param input stream which must contain XML content in the JGroups 
-    *              <code>stacks.xml</code> format
-    *              
-    * @return a map of the protocol stack configurations contained in the XML
-    * 
-    * @throws IllegalArgumentException if <code>input</code> is <code>null</code>
-    * @throws Exception
-    */
-   public static Map<String, ProtocolStackConfigInfo> parse(InputStream input) throws Exception 
-   {
-      if (input == null)
-      {
-         throw new IllegalArgumentException("null input");
-      }
-      
-      DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
-      factory.setValidating(false); //for now
-      DocumentBuilder builder=factory.newDocumentBuilder();
-      Document document=builder.parse(input);
-
-      // The root element of the document should be the "config" element,
-      // but the parser(Element) method checks this so a check is not
-      // needed here.
-      Element configElement = document.getDocumentElement();
-      return parse(configElement);
-   }
-   
-   /**
-    * Parses the contents of <code>root</code> into a map of the
-    * protocol stack configurations contained in the XML.
-    * 
-    * @param root document root node for XML content in the JGroups 
-    *              <code>stacks.xml</code> format
-    *              
-    * @return a map of the protocol stack configurations contained in the XML
-    * 
-    * @throws IllegalArgumentException if <code>input</code> is <code>null</code>
-    * @throws Exception
-    */
-   public static Map<String, ProtocolStackConfigInfo> parse(Element root) throws Exception 
-   {
-      if (root == null)
-      {
-         throw new IllegalArgumentException("null root");
-      }
-      
-      String root_name = root.getNodeName();
-      if (!PROTOCOL_STACKS.equals(root_name.trim().toLowerCase()))
-      {
-         throw new IOException("Invalid XML configuration: configuration does not start with a '" + 
-                        PROTOCOL_STACKS + "' element");
-      }
-
-      Map<String, ProtocolStackConfigInfo> result = new HashMap<String, ProtocolStackConfigInfo>();
-
-      NodeList tmp_stacks = root.getChildNodes();
-      for (int i = 0; i < tmp_stacks.getLength(); i++)
-      {
-         Node node = tmp_stacks.item(i);
-         if (node.getNodeType() != Node.ELEMENT_NODE)
-            continue;
-
-         Element stack = (Element) node;
-         String tmp = stack.getNodeName();
-         if (!STACK.equals(tmp.trim().toLowerCase()))
-         {
-            throw new IOException("Invalid configuration: didn't find a \"" + STACK + "\" element under \""
-                  + PROTOCOL_STACKS + "\"");
-         }
-
-         NamedNodeMap attrs = stack.getAttributes();
-         Node name = attrs.getNamedItem(NAME);
-         String st_name = name.getNodeValue();
-         Node descr=attrs.getNamedItem(DESCR);
-         String stack_descr=descr.getNodeValue();
-         if (log.isTraceEnabled())
-         {
-            log.trace("Parsing \"" + st_name + "\" (" + stack_descr + ")");
-         }
-         NodeList configs = stack.getChildNodes();
-         for (int j = 0; j < configs.getLength(); j++)
-         {
-            Node tmp_config = configs.item(j);
-            if (tmp_config.getNodeType() != Node.ELEMENT_NODE)
-               continue;
-            Element cfg = (Element) tmp_config;
-            tmp = cfg.getNodeName();
-            if (!CONFIG.equals(tmp))
-            {
-               throw new IOException("Invalid configuration: didn't find a \"" + 
-                     CONFIG + "\" element under \"" + STACK + "\"");
-            }
-
-            XmlConfigurator conf = XmlConfigurator.getInstance(cfg);
-            // fixes http://jira.jboss.com/jira/browse/JGRP-290
-            ConfiguratorFactory.substituteVariables(conf); // replace vars with system props
-
-            result.put(st_name, new ProtocolStackConfigInfo(st_name, stack_descr, conf));
-         }
-      }
-
-      return result;
-   }
-   
-   public static ProtocolData[] getProtocolData(ProtocolStackConfigurator config)
-   {
-      ProtocolData[] result = null;
-      try
-      {
-         result = config.getProtocolStack();
-      }
-      catch (UnsupportedOperationException e)
-      {
-         String s = config.getProtocolStackString();
-         String[] prots = s.split(":");
-         result = new ProtocolData[prots.length];
-         for (int i = 0; i < prots.length; i++)
-         {
-            ProtocolParameter[] params = null;
-            int paren = prots[i].indexOf('(');
-            String name = paren > - 1 ? prots[i].substring(0, paren) : prots[1];
-            if (paren > -1 && paren < prots[1].length() - 2)
-            {
-               String unsplit = prots[i].substring(paren + 1, prots[i].length() -1);
-               String[] split = unsplit.split(";");
-                params = new ProtocolParameter[split.length];
-               for (int j = 0; j < split.length; j++)
-               {
-                  String[] keyVal = split[j].split("=");
-                  params[j] = new ProtocolParameter(keyVal[0], keyVal[1]);
-               }
-            }
-            else
-            {
-               params = new ProtocolParameter[0];
-            }
-            
-            result[i] = new ProtocolData(name, null, name, params);
-         }
-      }
-      
-      return result == null ? new ProtocolData[0] : result;
-   }   
-   
-   /**
-    * Prevent instantiation.
-    */
-   private ProtocolStackUtil()
-   {
-   }
-
-}

Deleted: trunk/cluster/src/main/java/org/jboss/ha/framework/server/RspFilterAdapter.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/RspFilterAdapter.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/RspFilterAdapter.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.ha.framework.server;
-
-import org.jboss.ha.framework.interfaces.ResponseFilter;
-import org.jgroups.Address;
-import org.jgroups.blocks.RspFilter;
-
-/**
- * JGroups RspFilter adapter class that delegates work to ResponseFilter, 
- * Cluster abstraction of RspFilter.
- * 
- * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- */
-public class RspFilterAdapter implements RspFilter
-{
-   private final ResponseFilter filter;
-
-   private final ClusterNodeFactory factory;
-
-   public RspFilterAdapter(ResponseFilter filter, ClusterNodeFactory factory)
-   {
-      this.filter = filter;
-      this.factory = factory;
-   }
-
-   public boolean isAcceptable(Object response, Address sender)
-   {
-      return filter.isAcceptable(response, factory.getClusterNode(sender));
-   }
-
-   public boolean needMoreResponses()
-   {
-      return filter.needMoreResponses();
-   }
-}

Modified: trunk/cluster/src/main/java/org/jboss/ha/framework/server/managed/OpenChannelsMapper.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/managed/OpenChannelsMapper.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/managed/OpenChannelsMapper.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -32,7 +32,7 @@
 
 import javax.management.ObjectName;
 
-import org.jboss.ha.framework.server.ChannelInfo;
+import org.jboss.ha.core.channelfactory.ChannelInfo;
 import org.jboss.ha.framework.server.JChannelFactory;
 import org.jboss.metatype.api.types.CollectionMetaType;
 import org.jboss.metatype.api.types.CompositeMetaType;

Modified: trunk/cluster/src/main/java/org/jboss/ha/framework/server/managed/ProtocolStackConfigurationsMapper.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/managed/ProtocolStackConfigurationsMapper.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/managed/ProtocolStackConfigurationsMapper.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -26,7 +26,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.jboss.ha.framework.server.ProtocolStackConfigInfo;
+import org.jboss.ha.core.channelfactory.ProtocolStackConfigInfo;
 import org.jboss.metatype.api.types.CompositeMetaType;
 import org.jboss.metatype.api.types.ImmutableCompositeMetaType;
 import org.jboss.metatype.api.types.MetaType;

Modified: trunk/cluster/src/main/java/org/jboss/ha/framework/server/util/PingJndi.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/util/PingJndi.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/util/PingJndi.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -28,7 +28,7 @@
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 
-import org.jboss.ha.framework.server.AddressPort;
+import org.jboss.ha.core.framework.server.AddressPort;
 import org.jboss.logging.Logger;
 import org.jboss.system.ServiceMBeanSupport;
 

Modified: trunk/cluster/src/main/java/org/jboss/ha/framework/server/util/TopologyMonitorService.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/util/TopologyMonitorService.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/util/TopologyMonitorService.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -32,10 +32,10 @@
 
 import org.apache.log4j.MDC;
 import org.jboss.bootstrap.spi.as.config.JBossASBasedConfigurationInitializer;
+import org.jboss.ha.core.framework.server.AddressPort;
 import org.jboss.ha.framework.interfaces.ClusterNode;
 import org.jboss.ha.framework.interfaces.HAPartition;
 import org.jboss.ha.framework.interfaces.HAPartition.AsynchHAMembershipListener;
-import org.jboss.ha.framework.server.AddressPort;
 import org.jboss.ha.framework.server.HAPartitionLocator;
 import org.jboss.logging.Logger;
 import org.jboss.system.ServiceMBeanSupport;

Modified: trunk/cluster/src/main/java/org/jboss/ha/jndi/LookupSucceededFilter.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/jndi/LookupSucceededFilter.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/ha/jndi/LookupSucceededFilter.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -21,9 +21,9 @@
  */
 package org.jboss.ha.jndi;
 
+import org.jboss.ha.core.framework.server.CoreGroupCommunicationService.NoHandlerForRPC;
 import org.jboss.ha.framework.interfaces.ClusterNode;
 import org.jboss.ha.framework.interfaces.ResponseFilter;
-import org.jboss.ha.framework.server.ClusterPartition.NoHandlerForRPC;
 import org.jboss.logging.Logger;
 
 /**

Modified: trunk/cluster/src/main/java/org/jboss/invocation/unified/interfaces/UnifiedInvokerHAProxy.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/invocation/unified/interfaces/UnifiedInvokerHAProxy.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/main/java/org/jboss/invocation/unified/interfaces/UnifiedInvokerHAProxy.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -267,9 +267,9 @@
                   throw ((Exception) response);
                }
             }
-            if(response instanceof MarshalledObject)
+            if(response instanceof MarshalledObject<?>)
             {
-               haResponse = (HARMIResponse) ((MarshalledObject) response).get();
+               haResponse = (HARMIResponse) ((MarshalledObject<?>) response).get();
             }
             else
             {

Modified: trunk/cluster/src/resources/jgroups/jgroups-channelfactory-jboss-beans.xml
===================================================================
--- trunk/cluster/src/resources/jgroups/jgroups-channelfactory-jboss-beans.xml	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/cluster/src/resources/jgroups/jgroups-channelfactory-jboss-beans.xml	2010-06-05 13:49:33 UTC (rev 105748)
@@ -7,7 +7,7 @@
          on any shared channel -->
 	<bean name="JChannelFactory" class="org.jboss.ha.framework.server.JChannelFactory">
 	
-		  <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.jgroups:service=ChannelFactory", exposedInterface=org.jboss.ha.framework.server.JChannelFactoryMBean.class, registerDirectly=false)</annotation>
+		  <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.jgroups:service=ChannelFactory", exposedInterface=org.jboss.ha.core.channelfactory.JChannelFactoryMBean.class, registerDirectly=false)</annotation>
         
         <property name="multiplexerConfig">META-INF/jgroups-channelfactory-stacks.xml</property>
         

Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/component-matrix/pom.xml	2010-06-05 13:49:33 UTC (rev 105748)
@@ -97,10 +97,11 @@
     <version.org.jboss.cache.pojo>3.0.0.GA</version.org.jboss.cache.pojo>
     <version.org.jboss.cl>2.2.0.Alpha5</version.org.jboss.cl>
     <version.org.jboss.classpool>1.0.0.Alpha5</version.org.jboss.classpool>
-    <version.org.jboss.cluster.cache.jbc>2.3.0.Final</version.org.jboss.cluster.cache.jbc>
+    <version.org.jboss.cluster.cache.jbc>2.4.0.Alpha2</version.org.jboss.cluster.cache.jbc>
     <version.org.jboss.cluster.cache.spi>2.2.0.Final</version.org.jboss.cluster.cache.spi>
     <version.org.jboss.cluster.client>1.1.1.GA</version.org.jboss.cluster.client>
-    <version.org.jboss.cluster.server.api>2.0.0.Alpha3</version.org.jboss.cluster.server.api>
+    <version.org.jboss.cluster.server.api>2.0.0.Alpha4</version.org.jboss.cluster.server.api>
+    <version.org.jboss.cluster.server.core>1.0.0.Alpha2</version.org.jboss.cluster.server.core>
     <version.org.jboss.common.core>2.2.17.GA</version.org.jboss.common.core>
     <version.org.jboss.deployers>2.2.0.Alpha5</version.org.jboss.deployers>
     <version.org.jboss.ejb3.bom>0.1.2</version.org.jboss.ejb3.bom>
@@ -2396,6 +2397,26 @@
       
       <dependency>
         <groupId>org.jboss.cluster</groupId>
+        <artifactId>jboss-ha-server-core</artifactId>
+        <version>${version.org.jboss.cluster.server.core}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>org.jboss</groupId>
+            <artifactId>jboss-common-core</artifactId>            
+          </exclusion>
+          <exclusion>
+            <groupId>org.jboss.logging</groupId>
+            <artifactId>jboss-logging-spi</artifactId>            
+          </exclusion>
+          <exclusion>
+            <groupId>jgroups</groupId>
+            <artifactId>jgroups</artifactId>            
+          </exclusion>
+        </exclusions>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.cluster</groupId>
         <artifactId>jboss-ha-server-cache-spi</artifactId>
         <version>${version.org.jboss.cluster.cache.spi}</version>
         <exclusions>

Modified: trunk/testsuite/build.xml
===================================================================
--- trunk/testsuite/build.xml	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/build.xml	2010-06-05 13:49:33 UTC (rev 105748)
@@ -262,6 +262,7 @@
       <fileset refid="org.codehaus.woodstox:wstx-lgpl:jar"/>
       <fileset refid="org.jboss.cluster:jboss-ha-client:jar"/>
       <fileset refid="org.jboss.cluster:jboss-ha-server-api:jar"/>
+      <fileset refid="org.jboss.cluster:jboss-ha-server-core:jar"/>
       <fileset refid="org.jboss.cluster:jboss-ha-server-cache-jbc:jar"/>
       <fileset refid="org.jboss.cluster:jboss-ha-server-cache-spi:jar"/>
       <fileset refid="org.jboss.jaxr:juddi-saaj:jar"/>

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	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/DRMTestCase.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -30,12 +30,12 @@
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
 
+import org.jboss.ha.core.framework.server.ClusterNodeFactory;
+import org.jboss.ha.core.framework.server.DistributedReplicantManagerImpl;
 import org.jboss.ha.framework.interfaces.ClusterNode;
 import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
 import org.jboss.ha.framework.interfaces.DistributedReplicantManager.ReplicantListener;
-import org.jboss.ha.framework.server.ClusterNodeFactory;
 import org.jboss.ha.framework.server.ClusterPartition;
-import org.jboss.ha.framework.server.DistributedReplicantManagerImpl;
 import org.jboss.ha.framework.server.JChannelFactory;
 import org.jboss.logging.Logger;
 import org.jboss.test.cluster.hapartition.drm.MockHAPartition;

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/JChannelFactoryClassLoaderLeakTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/JChannelFactoryClassLoaderLeakTestCase.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/JChannelFactoryClassLoaderLeakTestCase.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -56,17 +56,67 @@
    
    static
    {
-      Class clazz = JChannelFactory.class;
+      Class<?> clazz = JChannelFactory.class;
+      Class<?> parentClazz = clazz.getSuperclass();
       try
       {
          OBJECT_ARG = clazz.getDeclaredMethod("createChannel", new Class[] { Object.class });
+      }
+      catch (NoSuchMethodException nsme)
+      {
+         try
+         {
+            OBJECT_ARG = parentClazz.getDeclaredMethod("createChannel", new Class[] { Object.class });
+         }
+         catch (NoSuchMethodException nsme1)
+         {
+            log.error("Reflection failure", nsme);
+         }
+      }
+      try
+      {
          STRING_ARG = clazz.getDeclaredMethod("createChannel", new Class[] { String.class });
+      }
+      catch (NoSuchMethodException nsme)
+      {
+         try
+         {
+            STRING_ARG = parentClazz.getDeclaredMethod("createChannel", new Class[] { String.class });
+         }
+         catch (NoSuchMethodException nsme1)
+         {
+            log.error("Reflection failure", nsme);
+         }
+      }
+      try
+      {
          SIMPLE_MUX = clazz.getDeclaredMethod("createMultiplexerChannel", new Class[] { String.class, String.class });
+      }
+      catch (NoSuchMethodException nsme)
+      {
+         try
+         {
+            SIMPLE_MUX = parentClazz.getDeclaredMethod("createMultiplexerChannel", new Class[] { String.class, String.class });
+         }
+         catch (NoSuchMethodException nsme1)
+         {
+            log.error("Reflection failure", nsme);
+         }
+      }
+      try
+      {
          COMPLEX_MUX = clazz.getDeclaredMethod("createMultiplexerChannel", new Class[] { String.class, String.class, boolean.class, String.class });
       }
       catch (NoSuchMethodException nsme)
       {
-         log.error("Reflection failure", nsme);
+         try
+         {
+            COMPLEX_MUX = parentClazz.getDeclaredMethod("createMultiplexerChannel", new Class[] { String.class, String.class, boolean.class, String.class });
+         }
+         catch (NoSuchMethodException nsme1)
+         {
+            log.error("Reflection failure", nsme);
+         }
       }
    }
    

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/JChannelFactoryOverrideUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/JChannelFactoryOverrideUnitTestCase.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/JChannelFactoryOverrideUnitTestCase.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -30,15 +30,15 @@
 
 import junit.framework.TestCase;
 
+import org.jboss.ha.core.channelfactory.ProtocolStackConfigInfo;
 import org.jboss.ha.framework.server.JChannelFactory;
-import org.jboss.ha.framework.server.ProtocolStackConfigInfo;
 import org.jboss.ha.framework.server.managed.ProtocolDataProtocolStackConfigurator;
 import org.jboss.logging.Logger;
 import org.jgroups.Channel;
 import org.jgroups.JChannel;
-import org.jgroups.protocols.TP;
 import org.jgroups.conf.ProtocolData;
 import org.jgroups.conf.ProtocolParameter;
+import org.jgroups.protocols.TP;
 
 /**
  * Tests JChannelFactory's handling of configuration overrides via

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/LookupSucceededFilterUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/LookupSucceededFilterUnitTestCase.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/LookupSucceededFilterUnitTestCase.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -23,11 +23,11 @@
 
 import junit.framework.TestCase;
 
+import org.jboss.ha.core.framework.server.ClusterNodeFactory;
+import org.jboss.ha.core.framework.server.RspFilterAdapter;
 import org.jboss.ha.framework.interfaces.ClusterNode;
 import org.jboss.ha.framework.interfaces.ResponseFilter;
-import org.jboss.ha.framework.server.ClusterNodeFactory;
 import org.jboss.ha.framework.server.ClusterPartition;
-import org.jboss.ha.framework.server.RspFilterAdapter;
 import org.jboss.ha.jndi.LookupSucceededFilter;
 import org.jboss.test.cluster.testutil.TestClusterNodeFactory;
 import org.jgroups.Address;

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/OpenChannelsMapperUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/OpenChannelsMapperUnitTestCase.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/OpenChannelsMapperUnitTestCase.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -30,7 +30,7 @@
 
 import junit.framework.TestCase;
 
-import org.jboss.ha.framework.server.ChannelInfo;
+import org.jboss.ha.core.channelfactory.ChannelInfo;
 import org.jboss.ha.framework.server.JChannelFactory;
 import org.jboss.ha.framework.server.managed.OpenChannelsMapper;
 import org.jboss.logging.Logger;

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/PreferredMasterElectionPolicyUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/PreferredMasterElectionPolicyUnitTestCase.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/PreferredMasterElectionPolicyUnitTestCase.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -29,10 +29,10 @@
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.jboss.ha.core.framework.server.ClusterNodeFactory;
 import org.jboss.ha.framework.interfaces.ClusterNode;
-import org.jboss.ha.framework.server.ClusterNodeFactory;
+import org.jboss.ha.singleton.PreferredMasterElectionPolicy;
 import org.jboss.test.cluster.testutil.TestClusterNodeFactory;
-import org.jboss.ha.singleton.PreferredMasterElectionPolicy;
 import org.jgroups.stack.IpAddress;
 
 /**

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ProtocolStackConfigurationsMapperUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ProtocolStackConfigurationsMapperUnitTestCase.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ProtocolStackConfigurationsMapperUnitTestCase.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -30,13 +30,12 @@
 
 import junit.framework.TestCase;
 
+import org.jboss.ha.core.channelfactory.ProtocolStackConfigInfo;
 import org.jboss.ha.framework.server.JChannelFactory;
-import org.jboss.ha.framework.server.ProtocolStackConfigInfo;
 import org.jboss.ha.framework.server.managed.ProtocolStackConfigurationsMapper;
 import org.jboss.logging.Logger;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.test.cluster.channelfactory.managed.ManagedObjectTestUtil;
-import org.jgroups.Channel;
 
 /**
  * Unit tests for ProtocolStackConfigurationsMapper

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -104,11 +104,13 @@
   
    public Object runRetrieveAll() throws Exception
    {
+      log.debug("runRetrieveAll");
       return partition.callMethodOnCluster(rpcServiceName, METHOD_GET_PERSON, null, null, false);
    }
    
    public Object runRetrieveQuery(PersonQuery query) throws Exception
    {
+      log.debug("runRetrieveQuery");
       Object[] parms = new Object[]{query};
       Class<?>[] types = new Class[]{PersonQuery.class};
       return partition.callMethodOnCluster(rpcServiceName, METHOD_GET_PERSON_MATCH, parms, types, false);
@@ -116,11 +118,13 @@
    
    public Object runRetrieveFromCoordinator() throws Exception
    {
+      log.debug("runRetrieveFromCoordinator");
       return partition.callMethodOnCoordinatorNode(rpcServiceName, METHOD_GET_PERSON, null, null, false);
    }
    
    public void runNotifyAllAsynch() throws Exception
    {
+      log.debug("runNotifyAllAsynch");
       Object[] parms = new Object[]{Boolean.TRUE};
       Class<?>[] types = new Class[]{Boolean.class};
       partition.callAsynchMethodOnCluster(rpcServiceName, METHOD_NOTIFY_PERSON, parms, types, false);

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/multicfg/test/HAPartitionStateTransferTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/multicfg/test/HAPartitionStateTransferTestCase.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/multicfg/test/HAPartitionStateTransferTestCase.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -87,10 +87,14 @@
          fail(parent.getClass().getName() + " caught; should be IllegalStateException");
       }
       
-      // Confirm the bad partition is removed from the current view
-      ObjectName partition = new ObjectName("jboss:service=BadProviderPartition");
-      Vector view = (Vector) adaptors[0].getAttribute(partition, "CurrentView");
-      assertEquals("View size after failure is correct", 1, view.size());
+      // The multiple HAPartitions in this test are now configured to use a
+      // MuxRpcDispatcher over the same Channel, so the following is no longer valid
+      // TODO consider having them create/connect their own channel
+      
+//      // Confirm the bad partition is removed from the current view
+//      ObjectName partition = new ObjectName("jboss:service=BadProviderPartition");
+//      Vector view = (Vector) adaptors[0].getAttribute(partition, "CurrentView");
+//      assertEquals("View size after failure is correct", 1, view.size());
    }
 
    public void testBadStateIntegration() throws Exception
@@ -117,10 +121,14 @@
          fail(parent.getClass().getName() + " caught; should be BadHAPartitionStateException");
       }
       
-      // Confirm the bad partition is removed from the current view
-      ObjectName partition = new ObjectName("jboss:service=BadStatePartition");
-      Vector view = (Vector) adaptors[0].getAttribute(partition, "CurrentView");
-      assertEquals("View size after failure is correct", 1, view.size());
+      // The multiple HAPartitions in this test are now configured to use a
+      // MuxRpcDispatcher over the same Channel, so the following is no longer valid
+      // TODO consider having them create/connect their own channel
+      
+//      // Confirm the bad partition is removed from the current view
+//      ObjectName partition = new ObjectName("jboss:service=BadStatePartition");
+//      Vector view = (Vector) adaptors[0].getAttribute(partition, "CurrentView");
+//      assertEquals("View size after failure is correct", 1, view.size());
    }
    
    public void testNoStateTransfer() throws Exception

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/testutil/MockHAPartition.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/testutil/MockHAPartition.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/testutil/MockHAPartition.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -34,7 +34,9 @@
 import org.jboss.ha.framework.interfaces.GroupMembershipListener;
 import org.jboss.ha.framework.interfaces.HAPartition;
 import org.jboss.ha.framework.interfaces.ResponseFilter;
+import org.jboss.ha.framework.interfaces.SerializableStateTransferResult;
 import org.jboss.ha.framework.interfaces.StateTransferProvider;
+import org.jboss.ha.framework.interfaces.StreamStateTransferResult;
 
 /**
  * Mock implementation of HAPartition intended to support unit testing
@@ -331,18 +333,24 @@
       // changes to the target DRM
    }
 
-   public Future<Serializable> getServiceState(String serviceName)
+   public Future<SerializableStateTransferResult> getServiceState(String serviceName)
    {
       // TODO Auto-generated method stub
       return null;
    }
 
-   public Future<Serializable> getServiceState(String serviceName, ClassLoader classloader)
+   public Future<SerializableStateTransferResult> getServiceState(String serviceName, ClassLoader classloader)
    {
       // TODO Auto-generated method stub
       return null;
    }
 
+   public Future<StreamStateTransferResult> getServiceStateAsStream(String serviceName)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
    public void registerStateTransferProvider(String serviceName, StateTransferProvider provider)
    {
       // no-op. at this point the test fixture directly passes state

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/testutil/TestClusterNodeFactory.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/testutil/TestClusterNodeFactory.java	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/testutil/TestClusterNodeFactory.java	2010-06-05 13:49:33 UTC (rev 105748)
@@ -22,8 +22,8 @@
 
 package org.jboss.test.cluster.testutil;
 
+import org.jboss.ha.core.framework.server.ClusterNodeFactory;
 import org.jboss.ha.framework.interfaces.ClusterNode;
-import org.jboss.ha.framework.server.*;
 import org.jgroups.Address;
 import org.jgroups.stack.IpAddress;
 

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	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/resources/cluster/ejb2/passexp/META-INF/partition-passexp-jboss-beans.xml	2010-06-05 13:49:33 UTC (rev 105748)
@@ -121,11 +121,6 @@
     	 
       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=PassExpPartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
       
-      <demand>PassExpPartitionCacheConfigSupply</demand>
-      
-      <!-- ClusterPartition requires a Cache for state management -->
-      <property name="cacheHandler"><inject bean="PassExpCacheHandler"/></property>
-               
       <!-- Name of the partition being built -->
       <property name="partitionName">PassExpPartition</property>
               

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	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/resources/cluster/hasingleton/electionpolicy/ha-electionpolicy-jboss-beans.xml	2010-06-05 13:49:33 UTC (rev 105748)
@@ -245,96 +245,18 @@
       <property name="targetStartMethod">startSingleton</property>
       <property name="targetStopMethod">stopSingleton</property>
    </bean>
-      
-   <bean name="ElectionPolicyTestCacheConfig" 
-   		class="org.jboss.cache.config.Configuration">
-      
-        <!-- When we're installed, register ourself -->
-        <install bean="CacheConfigurationRegistry" method="registerConfiguration">
-          <parameter>election-policy</parameter>
-          <parameter><this/></parameter>
-        </install>
-      
-        <!-- When we're uninstalled, unregister ourself -->
-        <uninstall bean="CacheConfigurationRegistry" method="unregisterConfiguration">
-          <parameter>election-policy</parameter>
-        </uninstall>
-        
-        <!-- The ClusterPartition beans need to wait until we are completely 
-             installed and have register ourself -->
-        <supply>ElectionPolicyCacheConfigSupply</supply>
-        
-        <!-- Externally injected services -->  
-        <property name="runtimeConfig">
-           <bean name="ElectionPolicyTestCacheRuntimeConfig" class="org.jboss.cache.config.RuntimeConfig">
-              <property name="transactionManager"><inject bean="jboss:service=TransactionManager" property="TransactionManager"/></property>
-           </bean>
-        </property>
-        
-        <property name="multiplexerStack">${jboss.multiplexer.stack:udp}</property>
-
-        <!-- Valid isolation levels are 
-                              SERIALIZABLE
-                              REPEATABLE_READ (default)
-                              READ_COMMITTED
-                              READ_UNCOMMITTED
-                              NONE
-        -->
-        <property name="isolationLevelString">REPEATABLE_READ</property>
-
-        <!-- Valid modes are LOCAL, REPL_ASYNC and REPL_SYNC -->
-        <property name="cacheModeString">REPL_SYNC</property>
-
-        <!-- Just used for async repl: use a replication queue -->
-        <property name="useReplQueue">false</property>
-
-        <!-- Replication interval for replication queue (in ms) -->
-        <property name="replQueueInterval">0</property>
-
-        <!-- Max number of elements which trigger replication -->
-        <property name="replQueueMaxElements">10</property>
-
-        <!-- Name of cluster. Needs to be the same for all nodes in clusters, 
-          in order to find each other -->
-        <property name="clusterName">ElectionPolicyTestPartitionCache</property>
-
-        <!-- Whether or not to fetch state on joining a cluster  -->
-        <property name="fetchInMemoryState">true</property>
-
-        <!-- The max amount of time (in milliseconds) we wait until the
-            initial state (ie. the contents of the cache) are retrieved from
-            existing members in a clustered environment -->
-        <property name="stateRetrievalTimeout">5000</property>
-
-        <!-- Number of milliseconds to wait until all responses for a
-            synchronous call have been received. -->
-        <property name="syncReplTimeout">20000</property>
-
-        <!-- Max number of milliseconds to wait for a lock acquisition -->
-        <property name="lockAcquisitionTimeout">15000</property>
-        
-        <property name="exposeManagementStatistics">true</property>
-
-    </bean>
    
    
    <!-- ==================================================================== -->
    <!-- Partition used for testing failure to receive state                  -->
-   <!-- ==================================================================== -->
-
-   <bean name="ElectionPolicyCacheHandler"
-         class="org.jboss.ha.framework.server.HAPartitionCacheHandlerImpl">
-         <property name="cacheManager"><inject bean="CacheManager"/></property>
-         <property name="cacheConfigName">election-policy</property>
-   </bean>
+   <!-- ==================================================================== -->
    
    <bean name="ElectionPolicyTestPartition"
    		 class="org.jboss.ha.framework.server.ClusterPartition">     
    		 
-      <demand>ElectionPolicyCacheConfigSupply</demand>
-      
-      <!-- ClusterPartition requires a Cache for state management -->
-      <property name="cacheHandler"><inject bean="ElectionPolicyCacheHandler"/></property>
+      <!-- For this test we just create our own channel -->
+      <property name="channelFactory"><inject bean="JChannelFactory"/></property>
+      <property name="channelStackName">${jboss.multiplexer.stack:udp}</property>
                
       <!-- Name of the partition being built -->
       <property name="partitionName">ElectionPolicyTestPartition</property>

Modified: trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/resources/cluster/partition/jboss-beans.xml	2010-06-05 13:49:33 UTC (rev 105748)
@@ -8,78 +8,8 @@
          <parameter class="java.lang.String">META-INF/passexp-stacks.xml</parameter>
          <parameter>true</parameter>
       </install>
-   </bean>
+   </bean>  
    
-   <!-- First we create a Configuration object for the cache -->
-   <bean name="HAPartitionStateTransferTestCacheConfig" 
-   		class="org.jboss.cache.config.Configuration">
-   	
-   	  <!-- When we're installed, register ourself -->
-   	  <install bean="CacheConfigurationRegistry" method="registerConfiguration">
-          <parameter>ha-partition-state-transfer</parameter>
-          <parameter><this/></parameter>
-        </install>
-      
-        <!-- When we're uninstalled, unregister ourself -->
-        <uninstall bean="CacheConfigurationRegistry" method="unregisterConfiguration">
-          <parameter>ha-partition-state-transfer</parameter>
-        </uninstall>
-        
-        <!-- The ClusterPartition beans need to wait until we are completely 
-             installed and have register ourself -->
-        <supply>HAPartitionStateTransferTestCacheConfigSupply</supply>
-        
-        <!-- Externally injected services -->  
-        <property name="runtimeConfig">
-           <bean name="HAPartitionStateTransferTestCacheRuntimeConfig" class="org.jboss.cache.config.RuntimeConfig">
-              <property name="transactionManager"><inject bean="jboss:service=TransactionManager" property="TransactionManager"/></property>
-           </bean>
-        </property>
-        
-        <property name="multiplexerStack">passexp-${jboss.multiplexer.stack:udp}</property>
-
-        <!-- Valid isolation levels are 
-                              SERIALIZABLE
-                              REPEATABLE_READ (default)
-                              READ_COMMITTED
-                              READ_UNCOMMITTED
-                              NONE
-        -->
-        <property name="isolationLevelString">REPEATABLE_READ</property>
-
-        <!-- Valid modes are LOCAL, REPL_ASYNC and REPL_SYNC -->
-        <property name="cacheModeString">REPL_SYNC</property>
-
-        <!-- Name of cluster. Needs to be the same for all nodes in clusters, 
-          in order to find each other -->
-        <property name="clusterName">BadPartitionCache</property>
-
-        <!-- Whether or not to fetch state on joining a cluster  -->
-        <property name="fetchInMemoryState">true</property>
-
-        <!-- The max amount of time (in milliseconds) we wait until the
-            initial state (ie. the contents of the cache) are retrieved from
-            existing members in a clustered environment -->
-        <property name="stateRetrievalTimeout">5000</property>
-
-        <!-- Number of milliseconds to wait until all responses for a
-            synchronous call have been received. -->
-        <property name="syncReplTimeout">20000</property>
-
-        <!-- Max number of milliseconds to wait for a lock acquisition -->
-        <property name="lockAcquisitionTimeout">15000</property>
-        
-        <property name="exposeManagementStatistics">true</property>
-
-   </bean>
-   
-   <bean name="HAPartitionStateTransferTestCacheHandler"
-         class="org.jboss.ha.framework.server.HAPartitionCacheHandlerImpl">
-         <property name="cacheManager"><inject bean="CacheManager"/></property>
-         <property name="cacheConfigName">ha-partition-state-transfer</property>
-   </bean>
-   
-   
    <!-- ==================================================================== -->
    <!-- Partition used for testing failure to receive state                  -->
    <!-- ==================================================================== -->
@@ -95,11 +25,13 @@
       
       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=BadProviderPartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
    	        
-      <demand>HAPartitionStateTransferTestCacheConfigSupply</demand>
+      <demand>PassExpStackInjector</demand>
       
-   	<!-- ClusterPartition requires a Cache for state management -->
-      <property name="cacheHandler"><inject bean="HAPartitionStateTransferTestCacheHandler"/></property>
+      <property name="channelFactory"><inject bean="JChannelFactory"/></property>
+      <property name="channelStackName">passexp-${jboss.multiplexer.stack:udp}</property>
                
+      <property name="scopeId">112</property>
+      
       <!-- Name of the partition being built -->
       <property name="partitionName">BadProviderPartition</property>
               
@@ -145,10 +77,12 @@
 
    	<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=BadStatePartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
    	
-      <demand>HAPartitionStateTransferTestCacheConfigSupply</demand>
-      
-      <!-- ClusterPartition requires a Cache for state management -->
-      <property name="cacheHandler"><inject bean="HAPartitionStateTransferTestCacheHandler"/></property>
+      <demand>PassExpStackInjector</demand>
+      
+      <property name="channelFactory"><inject bean="JChannelFactory"/></property>
+      <property name="channelStackName">passexp-${jboss.multiplexer.stack:udp}</property>
+               
+      <property name="scopeId">113</property>
                
       <!-- Name of the partition being built -->
       <property name="partitionName">BadStatePartition</property>
@@ -195,10 +129,12 @@
 
    	<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=NoStatePartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
    		 
-      <demand>HAPartitionStateTransferTestCacheConfigSupply</demand>
-      
-      <!-- ClusterPartition requires a Cache for state management -->
-      <property name="cacheHandler"><inject bean="HAPartitionStateTransferTestCacheHandler"/></property>
+      <demand>PassExpStackInjector</demand>
+      
+      <property name="channelFactory"><inject bean="JChannelFactory"/></property>
+      <property name="channelStackName">passexp-${jboss.multiplexer.stack:udp}</property>
+               
+      <property name="scopeId">114</property>
                
       <!-- Name of the partition being built -->
       <property name="partitionName">NoStatePartition</property>
@@ -228,10 +164,12 @@
 
    	<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=GoodStatePartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
     
-      <demand>HAPartitionStateTransferTestCacheConfigSupply</demand>
-      
-      <!-- ClusterPartition requires a Cache for state management -->
-      <property name="cacheHandler"><inject bean="HAPartitionStateTransferTestCacheHandler"/></property>
+      <demand>PassExpStackInjector</demand>
+      
+      <property name="channelFactory"><inject bean="JChannelFactory"/></property>
+      <property name="channelStackName">passexp-${jboss.multiplexer.stack:udp}</property>
+         
+      <property name="scopeId">115</property>
                
       <!-- Name of the partition being built -->
       <property name="partitionName">GoodStatePartition</property>

Modified: trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml	2010-06-05 11:12:33 UTC (rev 105747)
+++ trunk/testsuite/src/resources/cluster/partition/partition-restart-jboss-beans.xml	2010-06-05 13:49:33 UTC (rev 105748)
@@ -110,11 +110,6 @@
     	 
       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=RestartPartition", exposedInterface=org.jboss.ha.framework.server.ClusterPartitionMBean.class)</annotation>
       
-      <demand>RestartPartitionCacheConfigSupply</demand>
-      
-      <!-- ClusterPartition requires a Cache for state management -->
-      <property name="cacheHandler"><inject bean="RestartCacheHandler"/></property>
-               
       <!-- Name of the partition being built -->
       <property name="partitionName">RestartPartition</property>
       
@@ -128,7 +123,7 @@
 		   <bean name="RestartDistributedState"
 		   		 class="org.jboss.ha.framework.server.DistributedStateImpl">		      
 		      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=DistributedState,partitionName=RestartPartition", exposedInterface=org.jboss.ha.framework.server.DistributedStateImplMBean.class, registerDirectly=true)</annotation>
-		      <property name="cacheHandler"><inject bean="RestartCacheHandler"/></property>		          
+		      <property name="cacheHandler"><inject bean="RestartCacheHandler"/></property>
 		   </bean>		   
       </property>
       



More information about the jboss-cvs-commits mailing list