[jboss-cvs] JBossCache/src/org/jboss/cache/pojo/jmx ...

Brian Stansberry brian.stansberry at jboss.com
Fri May 11 18:42:53 EDT 2007


  User: bstansberry
  Date: 07/05/11 18:42:53

  Modified:    src/org/jboss/cache/pojo/jmx  PojoCacheJmxWrapper.java
  Log:
  JMX cleanups
  
  Revision  Changes    Path
  1.5       +26 -12    JBossCache/src/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PojoCacheJmxWrapper.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- PojoCacheJmxWrapper.java	9 May 2007 18:22:36 -0000	1.4
  +++ PojoCacheJmxWrapper.java	11 May 2007 22:42:53 -0000	1.5
  @@ -100,7 +100,7 @@
            if (config == null)
            {
               throw new ConfigurationException("Must call setConfiguration() " +
  -                   "or setCache() before call to create()");
  +                   "or setPojoCache() before call to create()");
            }
            
            constructCache();
  @@ -111,7 +111,9 @@
            pojoCache.create();
         }
         
  -      registeredPlainCacheInCreate = registerPlainCache();
  +      registerPlainCache();
  +      
  +      plainCacheWrapper.create();
         
         created = true;
      }
  @@ -122,6 +124,8 @@
         {
            pojoCache.start();
         }
  +      
  +      plainCacheWrapper.start();
      }
   
      public void stop()
  @@ -130,6 +134,8 @@
         {
            pojoCache.stop();
         }
  +      
  +      plainCacheWrapper.stop();
      }
   
      public void destroy()
  @@ -137,13 +143,14 @@
         if (getManageCacheLifecycle())
         {
            pojoCache.destroy();
  -      }
         
  -      if (registeredPlainCacheInCreate)
  -      {
  +         // The cache is destroyed, so we shouldn't leave it registered
  +         // in JMX even if we didn't register it in create()
            unregisterPlainCache();
         }
         
  +      plainCacheWrapper.destroy();
  +      
         created = false;
      }
      
  @@ -189,7 +196,7 @@
         
         if (cacheObjectName == null)
         {
  -         cacheObjectName = objName.toString();
  +         cacheObjectName = objName.getCanonicalName();
         }
         
         return new ObjectName(cacheObjectName);
  @@ -240,6 +247,11 @@
   
      // --------------------------------------------------------------  Public methods
   
  +   public MBeanServer getMBeanServer()
  +   {
  +      return server;
  +   }
  +   
      /**
       * Sets the configuration that the underlying cache should use.
       * 
  @@ -270,7 +282,7 @@
      
      // ---------------------------------------------------------------  Private methods
      
  -   private void constructCache() throws ConfigurationException
  +   protected void constructCache() throws ConfigurationException
      {
         pojoCache = (PojoCacheImpl) PojoCacheFactory.createCache(config, false);
         
  @@ -279,7 +291,7 @@
         selfConstructed = true;
      }  
      
  -   private CacheJmxWrapper buildPlainCacheWrapper(PojoCache pojoCache)
  +   protected CacheJmxWrapper buildPlainCacheWrapper(PojoCache pojoCache)
      {
         CacheJmxWrapper plainCache = new CacheJmxWrapper();
         plainCache.setRegisterInterceptors(getRegisterInterceptors());
  @@ -292,8 +304,10 @@
      {
         if (registerPlainCache && !plainCacheRegistered && server != null)
         {
  -         log.debug("Registering plain cache under name " + plainCacheWrapper.getCacheObjectName());
  -         org.jboss.cache.jmx.JmxUtil.registerCacheMBean(server, plainCacheWrapper, plainCacheWrapper.getCacheObjectName());
  +         ObjectName ourName = new ObjectName(cacheObjectName);
  +         ObjectName plainName = JmxUtil.getPlainCacheObjectName(ourName);
  +         log.debug("Registering plain cache under name " + plainName.getCanonicalName());
  +         org.jboss.cache.jmx.JmxUtil.registerCacheMBean(server, plainCacheWrapper, plainName.getCanonicalName());
            plainCacheRegistered = true;
            return true;
         }
  
  
  



More information about the jboss-cvs-commits mailing list