Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6515972

Notifications chapter of JMX tutorial trail needs clarification

    XMLWordPrintable

    Details

      Description

      From ###@###.###:

      I think this chapter could benefit from some clarification.
      http://java.sun.com/docs/books/tutorial/jmx/notifs/index.html

      The first paragraph says:

      " To generate notifications, an MBean must implement the
        interface NotificationEmitter or extend
        NotificationBroadcasterSupport. To send a notification,
        you need to construct an instance of the class
        javax.management.Notification or a subclass (such as
        AttributeChangedNotification), and pass the instance
        to NotificationBroadcasterSupport.sendNotification.
      "

      This might be confusing to naive readers. And with the exposure that
      JMX gets these days we do have more and more naive readers.

      The confusing sentence is "and pass the instance
      to NotificationBroadcasterSupport.sendNotification."

      If you simply implement NotificationEmitter, without forwarding
      all calls to add/remove NL to a wrapped NotificationBroadcasterSupport,
      then simply do
         'new NotificationBroadcasterSupport().sendNotification()'
      to send your notification, it will not work.

      I think that this chapter should either explain how to implement
      the NotificationEmitter interface when not extending
      NotificationBroadcasterSupport, or link to some other doc that
      will explain it (e.g. point to an example like jmx-scandir).

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: