Skip to main content

How to get notification of jconsole connection inside mxbean

1 reply [Last post]
Joined: 2006-01-06

I have an application that I monitor using jconsole and a MXBean. I want to get notification when I connect to it using jconsole. I tried using the following code but get no notifications or errors.

MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName object = new ObjectName("my.object:type=Mybean");
mbs.registerMBean(this, object);
mbs.addNotificationListener(object, this, null, null);

where 'this' is a reference to a class that extends the NotificationBroadcasterSupport class and implements the NotificationListener interface with the handleNotification(Notification notification, Object handback) method.

Can anybody say what I'm missing.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-01-06

As nobody has replied am I to take it that what I'm asking is impossible.> Can anybody say that for me.