[jboss-cvs] JBossAS SVN: r58544 - trunk/system-jmx/src/main/org/jboss/system

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 18 06:13:12 EST 2006


Author: bstansberry at jboss.com
Date: 2006-11-18 06:13:11 -0500 (Sat, 18 Nov 2006)
New Revision: 58544

Modified:
   trunk/system-jmx/src/main/org/jboss/system/ListenerServiceMBeanSupport.java
Log:
Allow MC injection of the SubscriptionInfo list

Modified: trunk/system-jmx/src/main/org/jboss/system/ListenerServiceMBeanSupport.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/ListenerServiceMBeanSupport.java	2006-11-18 11:12:20 UTC (rev 58543)
+++ trunk/system-jmx/src/main/org/jboss/system/ListenerServiceMBeanSupport.java	2006-11-18 11:13:11 UTC (rev 58544)
@@ -111,7 +111,7 @@
 {
    // Private Data --------------------------------------------------
      
-   /** The mbean subscription specification list */
+   /** The list of mbean subscriptions */
    private List sublist; // if null, subscriptions not made
    
    /** The mbean subscription config in XML form */
@@ -129,6 +129,9 @@
    /** Filter to receive only registration events */
    private NotificationFilterSupport myFilter;   
   
+   /** Has subscribe() been called and unsubscribe not been called? */
+   private boolean subscribed;
+   
    // Constructors -------------------------------------------------
     
    /**
@@ -197,6 +200,16 @@
    
    // Public API ----------------------------------------------------
 
+   public List<SubscriptionInfo> getSubscriptions()
+   {
+      return sublist;
+   }
+
+   public void setSubscriptions(List<SubscriptionInfo> list)
+   {
+      this.sublist = list;
+   }
+   
    /**
     * Subscribes this MBean for JMX notifications.
     *
@@ -220,7 +233,7 @@
       throws Exception
    {
       // we need an xml subscription specification
-      if (this.xmllist != null)
+      if (this.xmllist != null && this.sublist == null)
       {
          // Parse the XML spec
          log.debug("Parsing subscription specification");
@@ -228,6 +241,10 @@
          
          subscribe(subscriptionList, dynamicSubscriptions, listener);
       }
+      else if (this.sublist != null)
+      {
+         subscribe(sublist, dynamicSubscriptions, listener);
+      }
       else
          log.debug("Subscription specification not provided");      
    }
@@ -244,7 +261,7 @@
       throws Exception
    {
       // return if already subscribed
-      if (this.sublist != null)
+      if (subscribed)
          return;
 
       // we need an subscription specification
@@ -276,6 +293,8 @@
             
             log.debug("Subscribed to MBeanServerDelegate, too");
          }
+         
+         subscribed = true;
       }
       else
          log.debug("Subscription list not provided");
@@ -287,7 +306,7 @@
    public void unsubscribe()
    {
       // return if not subscribed
-      if (this.sublist == null)
+      if (!subscribed)
          return;
       
       log.debug("Removing all JMX notification subscriptions");
@@ -323,8 +342,8 @@
             log.warn("Could not unsubscribe from MBeanServerDelegate", e);
          }
       }
-      // use sublist to indicate we've unsubscribed
-      this.sublist = null;
+      // indicate we've unsubscribed
+      this.subscribed = false;
    }
    
    // NotificationListener -----------------------------------------




More information about the jboss-cvs-commits mailing list