2 Replies Latest reply on Dec 28, 2002 9:27 AM by Adrian Brock

    Notification proposal

    Dain Sundstrom Master

      I see a problem with the JMX specification notification system, and it is the same problem the Java GUI listener system has. From what I understand for a MBean to fire off a notification anyone interested in the notification must register directly with the MBean and this creates a hard reference problem (the mean has a list of interested parties) that JMX works to remove.

      I think we can work around this without violation the specification by adding a new plain old MBean MBeanNotificationServer. This MBean would be always available, and would be the only holder of listener references. Any bean interested in a notification would register with the MBeanNotifcationServer and say "I want to know about invalidation events" for instances. When any MBean wants to fire an event is does so using the MBeanNotificationServer. The big benefit of this is the event source and event sink are completely decoupled, which gives us benefits such as independent redeployment.

      For pattern fanatics this is the mediator pattern.

      -dain

        • 1. Re: Notification proposal
          David Jencks Master

          I think you can already do this by adding your notification listener to the MBeanServer, supplying the object name you are interested in listening to. I think the methods on an mbean are there primarily so the MBeanServer has some hooks to use.

          Did I misunderstand?

          • 2. Re: Notification proposal
            Adrian Brock Master

            If I understand correctly, you want to do something
            like this - probably not as general as this :-)

            notificationServer.addNotificationListener(
            new ObjectName("*:type=Invalidator,*"),
            new ObjectName("*,type=Invalidated,*"),...);

            or

            String invalidateMessageType = "org.jboss.invalidate";
            notificationServer.addNotificationListener(
            invalidateMessageType,
            new ObjectName("jboss:service=me"),...);

            And the server will maintain the links as MBeans
            are removed/added.

            I'll look at doing this when I do the jmx1.2 compliance.
            There are other changes required in the notification
            aspect.

            Regards,
            Adrian