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

[Evt Srv] EventSubscriber.unsubscribe removes other listeners

    Details

    • Subcomponent:
    • Resolved In Build:
      b37
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Extract of EventConsumer.unsubscribe javadoc:
      "The listener to be removed must have been added by the subscribe method with the given name. If the name is a pattern, then the subscribe must have used the same pattern. If the same listener has been subscribed more than once to the name, perhaps with different filters or handbacks, then all such listeners are removed."

      What worries me is the "to the name" in the last sentence.
      In my case I effectively did 2 subscribe with the same listener but not to the same name.
      Perhaps my reading is wrong but I'm not sure if it's normal my 2 subscribers are removed by the call to unsubscribe.

      What I do:
      ObjectName pattern1 = new ObjectName("JMImplementation:type=MBeanServerDelegat?,*");
      subscriber.subscribe(pattern1, myListener, null, null);
      ObjectName pattern2 = MBeanServerDelegate.DELEGATE_NAME;
      subscriber.subscribe(pattern2, myListener, filter, null);
      subscriber.unsubscribe(pattern1, myListener);

      My names aren't equal:
      [SQE] GLOP JMImplementation:type=MBeanServerDelegat?,* equals JMImplementation:type=MBeanServerDelegate is false

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: