NotificationBroadcasterSupport
If I have my MBean extend NotificationBroadcasterSupport, am I required to override the getNotificationInfo() method? It seems it's returning a null if I don't. I guess this makes sense, as it's (an MBeanServer or other client) probably not able to determine what notifications my MBean sends without it. But it's not mentioned anywhere in the javadoc that I can see.
Alper
[390 byte] By [
aakturea] at [2007-11-27 3:18:07]

# 1
Yes, you are required to implement the getNotificationInfo if you want to see the information concerning the notifications your MBean can emit in the MBeanInfo although everything will work fine if you fail to do that. The MBeanServer is not checking that the notification emitted by a given MBean has been specified with the getNotificationInfo.
Currently you are responsible for populating the MBeanInfo with the notifications your MBean can emit. In the near future this could be done by means of annotating the MBean interface with JMX notification specific annotations.
Regards,
Luis
# 2
Hi,
If you're working with Java 6 you can provide an MBeanNotificationInfo[] array to
the NotificationBroadcasterSupport constructor.
So if you extend NotificationBroadcasterSupport and call super(notifs) in your
constructor you won't need to override getNotifications().
Hope this helps,
-- daniel
JMX, SNMP, Java, etc...
http://blogs.sun.com/jmxetc
# 3
Minor correction -- the method to override is getNotificationInfo().As Luis says, you do not absolutely have to supply this information, though some JMX clients might be confused if you don't.蒩monn McManus -- JMX Spec Lead -- http://weblogs.java.net/blog/emcmanus
# 4
Thanks for the answers. Further on down the road, during some discovery process after my MBean is registered, someone calls the getNotificationInfo() method, and does somethng with the return value, and was not checking for null. So by implementing that method I was able to avoid the NPE. Possibly there should be a check for null there as well.
alper