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

Clarify when EventClient.unsubscribe throws a ListenerNotFoundException

    Details

    • Subcomponent:
    • Introduced In Build:
      b37
    • Introduced In Version:
      7
    • CPU:
      generic
    • OS:
      generic

      Description

      As of JDK 7 b37.
      Please consider the following sequence:

          EventClient eventclient = new EventClient(getClient());
          NotificationListener listener = new SimpleListener();
          ObjectName pattern = new ObjectName("*:*");
          RankFilter filter = new RankFilter(discardedNotificationRank);
          // SUBSCRIBE WITH FILTER AND HANDBACK
          eventclient.subscribe(pattern, listener, filter, pattern);
          // UNSUBSCRIBE WITH SAME NAME AND PATTERN
          eventclient.unsubscribe(pattern, listener);

      You get:

      javax.management.ListenerNotFoundException
      at javax.management.event.EventClient.getMatchedListenerInfo(EventClient.java:817)
      at javax.management.event.EventClient.unsubscribe(EventClient.java:460)
      at javasoft.sqe.jmx.test.functional.EventClientTest2.run(EventClientTest2.java:125)
      at javasoft.sqe.jmx.share.TestStarter.<init>(TestStarter.java:28)
      at javasoft.sqe.jmx.share.TestStarter.main(TestStarter.java:79)

      EventConsumer.unsubscribe() javadoc says:

      ListenerNotFoundException - The given listener was not subscribed to the given name.

      The call to getMatchedListenerInfo() in the stack seems to say you can unsubscribe only if ListenerInfo matches, which isn't what the javadoc says.
      Do I miss something there ?

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: