]> gcc.gnu.org Git - gcc.git/commitdiff
Server.java (Server): Record the delegate.
authorAndrew Haley <aph@redhat.com>
Thu, 3 May 2007 18:30:33 +0000 (18:30 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Thu, 3 May 2007 18:30:33 +0000 (18:30 +0000)
2007-05-03  Andrew Haley  <aph@redhat.com>

        * gnu/javax/management/Server.java (Server): Record the delegate.
        (registerMBean): Notify the delegate.
        (unregisterMBean): Likewise.
        (notify): New method.

From-SVN: r124383

libjava/classpath/ChangeLog
libjava/classpath/gnu/javax/management/Server.java

index ad9f90829124e721cca478a952abed07f4f06dbd..158e90f634bfc470c664d5be389febb759d16693 100644 (file)
@@ -1,3 +1,10 @@
+2007-05-03  Andrew Haley  <aph@redhat.com>
+
+       * gnu/javax/management/Server.java (Server): Record the delegate.
+       (registerMBean): Notify the delegate.
+       (unregisterMBean): Likewise.
+       (notify): New method.
+
 2007-04-04  Francis Kung  <fkung@redhat.com>
 
        * gnu/java/awt/peer/gtk/ComponentGraphics.java
index aa39c75ad46c49734c1559337c7800472e429c4b..616854e95bdf3b69bc2b0ab6733243abc56c3bb5 100644 (file)
@@ -53,6 +53,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
 
 import javax.management.Attribute;
 import javax.management.AttributeList;
@@ -75,6 +76,7 @@ import javax.management.MBeanRegistration;
 import javax.management.MBeanRegistrationException;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerDelegate;
+import javax.management.MBeanServerNotification;
 import javax.management.MBeanTrustPermission;
 import javax.management.NotCompliantMBeanException;
 import javax.management.Notification;
@@ -136,6 +138,15 @@ public class Server
    */
   private Map listeners;
 
+  /**
+   * An MBean that emits notifications when an MBean is registered and
+   * unregistered with this server.
+   *
+   */
+  private final MBeanServerDelegate delegate;
+
+  static private final AtomicLong sequenceNumber = new AtomicLong(1);
+
   /**
    * Initialise the delegate name.
    */
@@ -171,6 +182,7 @@ public class Server
   {
     this.defaultDomain = defaultDomain;
     this.outer = outer;
+    this.delegate = delegate;
     try
       {
        registerMBean(delegate, DELEGATE_NAME);
@@ -1703,6 +1715,7 @@ public class Server
     beans.put(name, new ServerInfo(obji, obj));
     if (register != null)
       register.postRegister(Boolean.TRUE);
+    notify(name, MBeanServerNotification.REGISTRATION_NOTIFICATION);
     return obji;
   }
 
@@ -2088,10 +2101,18 @@ public class Server
          }
       }
     beans.remove(name);
+    notify(name, MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
     if (register != null)
       register.postDeregister();
   }
 
+   private void notify(ObjectName name, String type)
+   {
+      delegate.sendNotification
+       (new MBeanServerNotification
+        (type, DELEGATE_NAME, sequenceNumber.getAndIncrement(), name));
+   }
+
   /**
    * Input stream which deserializes using the given classloader.
    */
This page took 0.086402 seconds and 5 git commands to generate.