[jboss-cvs] JBossAS SVN: r72958 - trunk/cluster/src/main/org/jboss/ha/framework/server.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 1 16:57:29 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-05-01 16:57:29 -0400 (Thu, 01 May 2008)
New Revision: 72958

Modified:
   trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImpl.java
Log:
Prune dead code; fix listener lifecycle

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImpl.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImpl.java	2008-05-01 20:49:07 UTC (rev 72957)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedStateImpl.java	2008-05-01 20:57:29 UTC (rev 72958)
@@ -54,7 +54,6 @@
  */
 @CacheListener
 public class DistributedStateImpl
-//   extends ServiceMBeanSupport
    implements DistributedStateImplMBean
 {
    // Constants -----------------------------------------------------
@@ -69,7 +68,6 @@
    protected HashMap keyListeners = new HashMap ();
    protected HAPartition partition;
    protected Logger log;
-//   protected MBeanServer mbeanServer = null;
    protected String name = null;
    protected Cache cache;
    protected boolean replAsync;
@@ -92,60 +90,25 @@
 
    // Public --------------------------------------------------------
 
-   
-//   public void init () throws Exception
-//   {
-//      ObjectName name = new ObjectName("jboss.cache:service=ClusterTreeCache");
-//      cache = null;
-//      if (name == null) {
-//         log.debug("DistributedState - failed to get name for ClusterTreeCache MBean");
-//      }
-//      else {
-//         String method = "getInstance";
-//         Object o = mbeanServer.invoke(name, method, null, null);
-//         if (o == null) {
-//            log.debug("DistributedState - ClusterTreeCache instance is null");
-//         }
-//         else {
-//            log.debug("DistributedState - ClusterTreeCache instance is "+o.getClass().getName());
-//            cache = (TreeCache)o;
-//         }
-//      }
-//      cache.addTreeCacheListener(this);
-//
-//      // subscribed this "sub-service" of HAPartition with JMX
-//      // TODO: In the future (when state transfer issues will be completed),
-//      // we will need to redesign the way HAPartitions and its sub-protocols are
-//      // registered with JMX. They will most probably be independent JMX services.
-//      //
-//      this.name = "jboss:service=" + SERVICE_NAME +
-//                    ",partitionName=" + this.partition.getPartitionName();
-//      ObjectName jmxName = new ObjectName(this.name);
-//      mbeanServer.registerMBean(this, jmxName);
-//      Registry.bind (this.name, this);
-//   }
-
    protected void createService() throws Exception
    {
-//    super.createService();
    }
 
    public void startService() throws Exception
    {
       if (cache == null)
          throw new IllegalStateException("No clustered cache available");
-//      super.startService();
+
+      this.cache.addCacheListener(this);
    }
 
    public void stopService() throws Exception
    {
-//      super.stopService();
+      cache.removeCacheListener(this); 
    }
    
    public void destroyService() throws Exception
-   {
-//      super.destroyService();
-      cache.removeCacheListener(this);      
+   {     
    }
 
    public String listContent () throws Exception
@@ -230,7 +193,6 @@
       this.cache = cache;
       if (this.cache != null) 
       {
-      	this.cache.addCacheListener(this);
       	CacheMode cm = cache.getConfiguration().getCacheMode();
       	if (CacheMode.REPL_ASYNC == cm)
       	   this.replAsync = true;
@@ -540,16 +502,16 @@
       if (event.isPre())
          return;
       
-      // ignore changes for other roots in a shared cache
-      Fqn fqn = event.getFqn();
-      if (!fqn.isChildOf(ROOTFQN))
-         return;
-      
       // we're only interested in put and remove data operations
       ModificationType modType = event.getModificationType();
       if (!modType.equals(ModificationType.PUT_DATA) && !modType.equals(ModificationType.REMOVE_DATA))
          return;
       
+      // ignore changes for other roots in a shared cache
+      Fqn fqn = event.getFqn();
+      if (!fqn.isChildOf(ROOTFQN))
+         return;
+      
       Serializable key = null;
       Serializable value = null;
       




More information about the jboss-cvs-commits mailing list