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

Brian Stansberry brian.stansberry at jboss.com
Wed May 23 23:56:33 EDT 2007


  User: bstansberry
  Date: 07/05/23 23:56:33

  Modified:    src/org/jboss/cache/pojo/jmx  PojoCacheJmxWrapper.java
  Log:
  Support old versions of renamed attributes
  Dependency inject MultiplexerService rather than doing JMX lookup
  
  Revision  Changes    Path
  1.12      +40 -27    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.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- PojoCacheJmxWrapper.java	23 May 2007 20:24:16 -0000	1.11
  +++ PojoCacheJmxWrapper.java	24 May 2007 03:56:33 -0000	1.12
  @@ -40,6 +40,7 @@
   import org.jboss.cache.pojo.impl.PojoCacheImpl;
   import org.jgroups.Channel;
   import org.jgroups.ChannelFactory;
  +import org.jgroups.jmx.JChannelFactoryMBean;
   import org.w3c.dom.Element;
   
   import javax.management.JMException;
  @@ -69,7 +70,7 @@
      private Element evictionConfig;
      private Element cacheLoaderConfig;
      private Element clusterConfig;
  -   private ObjectName multiplexerService;
  +   private JChannelFactoryMBean multiplexerService;
   
      /**
       * Default constructor.
  @@ -279,11 +280,18 @@
         return buddyReplConfig;
      }
   
  -   public Element getCacheLoaderConfiguration()
  +   public Element getCacheLoaderConfig()
      {
         return cacheLoaderConfig;
      }
   
  +   public Element getCacheLoaderConfiguration()
  +   {
  +      log.warn("MBean attribute 'CacheLoaderConfiguration' is deprecated; " +
  +               "use 'CacheLoaderConfig'");
  +      return getCacheLoaderConfig();
  +   }
  +
      public String getCacheMode()
      {
         return getConfiguration().getCacheModeString();
  @@ -314,6 +322,13 @@
         return getConfiguration().getExposeManagementStatistics();
      }
   
  +   public boolean getUseInterceptorMbeans()
  +   {
  +      log.warn("MBean attribute 'UseInterceptorMbeans' is deprecated; " +
  +               "use 'ExposeManagementStatistics'");
  +      return getExposeManagementStatistics();
  +   }
  +
      public boolean getFetchInMemoryState()
      {
         return getConfiguration().isFetchInMemoryState();
  @@ -334,10 +349,7 @@
         return getConfiguration().getLockAcquisitionTimeout();
      }
   
  -   /**
  -    * @deprecated directly inject the ChannelFactory via {@link #setMuxChannelFactory(ChannelFactory)}
  -    */
  -   public ObjectName getMultiplexerService()
  +   public JChannelFactoryMBean getMultiplexerService()
      {
         return multiplexerService;
      }
  @@ -423,7 +435,7 @@
         this.buddyReplConfig = config;
      }
   
  -   public void setCacheLoaderConfiguration(Element cache_loader_config)
  +   public void setCacheLoaderConfig(Element cache_loader_config)
      {
         CacheLoaderConfig clc = null;
         if (cache_loader_config != null)
  @@ -434,6 +446,13 @@
         this.cacheLoaderConfig = cache_loader_config;
      }
   
  +   public void setCacheLoaderConfiguration(Element config)
  +   {
  +      log.warn("MBean attribute 'CacheLoaderConfiguration' is deprecated; " +
  +               "use 'CacheLoaderConfig'");
  +      setCacheLoaderConfig(config);
  +   }
  +
      public void setCacheMode(String mode) throws Exception
      {
         getConfiguration().setCacheModeString(mode);
  @@ -476,6 +495,13 @@
         getConfiguration().setExposeManagementStatistics(expose);
      }
   
  +   public void setUseInterceptorMbeans(boolean use)
  +   {
  +      log.warn("MBean attribute 'UseInterceptorMbeans' is deprecated; " +
  +               "use 'ExposeManagementStatistics'");
  +      setExposeManagementStatistics(use);
  +   }
  +
      public void setFetchInMemoryState(boolean flag)
      {
         getConfiguration().setFetchInMemoryState(flag);
  @@ -501,10 +527,7 @@
         getConfiguration().setLockAcquisitionTimeout(timeout);
      }
   
  -   /**
  -    * @deprecated directly inject the ChannelFactory via {@link #setMuxChannelFactory(ChannelFactory)}
  -    */
  -   public void setMultiplexerService(ObjectName muxService)
  +   public void setMultiplexerService(JChannelFactoryMBean muxService)
      {
         this.multiplexerService = muxService;
      }
  @@ -740,13 +763,10 @@
         // Only inject if there isn't already a channel or factory
         if (rtcfg.getMuxChannelFactory() != null && rtcfg.getChannel() != null)
         {
  -         MBeanServer mbs = getMBeanServer();
  -         if (mbs != null)
  -         {
               Channel ch;
               try
               {
  -               ch = (Channel) mbs.invoke(multiplexerService, "createMultiplexerChannel", new Object[]{cfg.getMultiplexerStack(), cfg.getClusterName()}, new String[]{String.class.getName(), String.class.getName()});
  +            ch = multiplexerService.createMultiplexerChannel(cfg.getMultiplexerStack(), cfg.getClusterName());
               }
               catch (Exception e)
               {
  @@ -754,13 +774,6 @@
               }
               rtcfg.setChannel(ch);
            }
  -         else
  -         {
  -            throw new CacheException("Cannot access " + multiplexerService +
  -                                     " as no MBeanServer is available. Register this MBean with " +
  -                                     "the JMX server before calling create()");
  -         }
  -      }
   
      }
      
  
  
  



More information about the jboss-cvs-commits mailing list