summaryrefslogtreecommitdiffstats
path: root/libjava
diff options
context:
space:
mode:
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-03 18:30:33 +0000
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-03 18:30:33 +0000
commit254b046275577c97f6c8ef61b96f91b57cf5295c (patch)
tree73a6a38c44f1baa52463630c1bfc9bf2dd832e44 /libjava
parenta7c1ab491b27ffe369254e6ba0cb7bbcbc5e0b0d (diff)
downloadppe42-gcc-254b046275577c97f6c8ef61b96f91b57cf5295c.tar.gz
ppe42-gcc-254b046275577c97f6c8ef61b96f91b57cf5295c.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124383 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/classpath/ChangeLog7
-rw-r--r--libjava/classpath/gnu/javax/management/Server.java21
2 files changed, 28 insertions, 0 deletions
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog
index ad9f9082912..158e90f634b 100644
--- a/libjava/classpath/ChangeLog
+++ b/libjava/classpath/ChangeLog
@@ -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
diff --git a/libjava/classpath/gnu/javax/management/Server.java b/libjava/classpath/gnu/javax/management/Server.java
index aa39c75ad46..616854e95bd 100644
--- a/libjava/classpath/gnu/javax/management/Server.java
+++ b/libjava/classpath/gnu/javax/management/Server.java
@@ -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;
@@ -137,6 +139,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.
*/
static
@@ -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.
*/
OpenPOWER on IntegriCloud