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

clarify EventClient spec about the EventClientDelegate MBean

XMLWordPrintable

      // Initialize Event Service stuff only if available (since JDK 7)
              try {
                  Class.forName("javax.management.event.EventManager");
                  eventManager = EventManager.getEventManager(mbs);
                  notifListener = new SimpleListener();
                  eventSourceON = new ObjectName("dummy:type=dummy");
                  eventListenON = new ObjectName("JMImplementation:type=MBeanServerDelegate");
                  notification = new SqeNotification("type", eventSourceON, 1L);
                  eventClient = new EventClient(mbs);
              } catch (ClassNotFoundException cnfe) {
                  Utils.trace("No JMX 2.0 Event Service found in the current JDK");
              }

      The bold line in the code above triggers the emission of the stack below with the JDK 7 draft:

      java.io.IOException: javax.management.InstanceNotFoundException: javax.management.event:type=EventClientDelegate
      at javax.management.event.EventClient.init(EventClient.java:269)
      at javax.management.event.EventClient.init(EventClient.java:245)
      at javax.management.event.EventClient.<init>(EventClient.java:147)
      at javasoft.sqe.jmx.test.perf_footprint.MemoryLeakTest.initActions(MemoryLeakTest.java:195)
      at javasoft.sqe.jmx.test.perf_footprint.MemoryLeakTest.run(MemoryLeakTest.java:135)
      at javasoft.sqe.jmx.share.TestStarter.<init>(TestStarter.java:28)
      at javasoft.sqe.jmx.share.TestStarter.main(TestStarter.java:79)
      Caused by: javax.management.InstanceNotFoundException: javax.management.event:type=EventClientDelegate
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1148)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:862)
      at com.sun.jmx.interceptor.MBeanServerDispatcher.invoke(MBeanServerDispatcher.java:276)
      at com.sun.jmx.interceptor.MBeanServerDispatcher.invoke(MBeanServerDispatcher.java:276)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:790)
      at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:330)
      at $Proxy0.addClient(Unknown Source)
      at javax.management.event.FetchingEventRelay.<init>(FetchingEventRelay.java:188)
      at javax.management.event.FetchingEventRelay.<init>(FetchingEventRelay.java:122)
      at javax.management.event.FetchingEventRelay.<init>(FetchingEventRelay.java:94)
      at javax.management.event.FetchingEventRelay.<init>(FetchingEventRelay.java:77)
      at javax.management.event.EventClient.init(EventClient.java:264)
      ... 6 more

      Sure the ECD MBean isn't found as I expect it to be.
      I didn't follow closely the latest changes in Evt Srv but apparently JMX connectors have been modified all the same (except perhaps WS and JMXMP) and there's now a forwarder in the picture.
      In my case I don't even have a connector; is my use of the API illegal (I mean it's for use client side only ?) ?
      If yes then the javadoc could clarify and/or the implementation might check the MBSC isn't an MBS.
      What do you think ?
      EventClient

      public EventClient(MBeanServerConnection conn)
                  throws java.io.IOException

          Constructs a default EventClient object.

          This object creates a FetchingEventRelay object to receive notifications forwarded by the EventClientDelegateMBean. The EventClientDelegateMBean that it works with is the default one registered with the ObjectName OBJECT_NAME. The forwarding thread of the FetchingEventRelay object is used to distribute notifications.

          Parameters:
              conn - An MBeanServerConnection object used to communicate with an EventClientDelegateMBean MBean.
          Throws:
              java.lang.IllegalArgumentException - If conn is null.
              java.io.IOException - If an I/O error occurs when communicating with the EventClientDelegateMBean.

            sjiang Shanliang Jiang (Inactive)
            yjoan Yves Joan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: