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

Brian Stansberry brian.stansberry at jboss.com
Mon Jun 4 18:56:16 EDT 2007


  User: bstansberry
  Date: 07/06/04 18:56:16

  Modified:    src/org/jboss/cache/jmx   CacheNotificationListener.java
                        CacheJmxWrapper.java
  Log:
  [JBCACHE-1089] PojoCacheJmxWrapper should implement NotificationEmitter
  
  Revision  Changes    Path
  1.5       +4 -4      JBossCache/src/org/jboss/cache/jmx/CacheNotificationListener.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheNotificationListener.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/jmx/CacheNotificationListener.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- CacheNotificationListener.java	30 May 2007 11:35:16 -0000	1.4
  +++ CacheNotificationListener.java	4 Jun 2007 22:56:16 -0000	1.5
  @@ -37,9 +37,9 @@
    * events.
    *
    * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
  -class CacheNotificationListener implements CacheListener
  +public class CacheNotificationListener implements CacheListener
   {
      // Notification Messages
      private static final String MSG_CACHE_STARTED = "Cache has been started.";
  @@ -82,7 +82,7 @@
         this.serviceName = serviceName;
      }
   
  -   public MBeanNotificationInfo[] getNotificationInfo()
  +   public static MBeanNotificationInfo[] getNotificationInfo()
      {
         String[] types = new String[]
               {
  
  
  
  1.26      +20 -5     JBossCache/src/org/jboss/cache/jmx/CacheJmxWrapper.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheJmxWrapper.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/jmx/CacheJmxWrapper.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -b -r1.25 -r1.26
  --- CacheJmxWrapper.java	24 May 2007 03:56:33 -0000	1.25
  +++ CacheJmxWrapper.java	4 Jun 2007 22:56:16 -0000	1.26
  @@ -63,7 +63,7 @@
    * {@link CacheImpl}.
    *
    * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
  - * @version $Revision: 1.25 $
  + * @version $Revision: 1.26 $
    */
   public class CacheJmxWrapper
         extends NotificationBroadcasterSupport
  @@ -80,6 +80,7 @@
      private final AtomicInteger listenerCount = new AtomicInteger(0);
      private final CacheNotificationListener cacheNotificationListener;
      private CacheStatus cacheStatus;
  +   private String notificationServiceName;
      
      // Legacy config support
   
  @@ -678,8 +679,11 @@
         }
   
         ObjectName result = new ObjectName(cacheObjectName);
  -      // Inform our CacheNotificationListener of our ObjectName
  -      cacheNotificationListener.setServiceName(result.getCanonicalName());
  +      
  +      // Inform our CacheNotificationListener of the ObjectName it should transmit
  +      if (notificationServiceName == null)
  +         notificationServiceName = result.getCanonicalName();
  +      cacheNotificationListener.setServiceName(notificationServiceName);
   
         return result;
      }
  @@ -694,7 +698,7 @@
         {
            log.debug("Registered in JMX under " + cacheObjectName);
   
  -         if (cache != null)
  +         if (cache != null && CacheStatus.STARTED.equals(cache.getCacheStatus()))
            {
               try
               {
  @@ -805,6 +809,17 @@
         return s;
      }
   
  +   public String getNotificationServiceName()
  +   {
  +      return notificationServiceName;
  +   }
  +
  +   public void setNotificationServiceName(String notificationServiceName)
  +   {
  +      this.notificationServiceName = notificationServiceName;
  +      this.cacheNotificationListener.setServiceName(notificationServiceName);
  +   }
  +
      // ----------------------------------------------------  Superclass Overrides
   
      @Override
  @@ -831,7 +846,7 @@
      @Override
      public MBeanNotificationInfo[] getNotificationInfo()
      {
  -      return cacheNotificationListener.getNotificationInfo();
  +      return CacheNotificationListener.getNotificationInfo();
      }
   
      // ------------------------------------------------------  Protected Methods
  
  
  



More information about the jboss-cvs-commits mailing list