-
Bug
-
Resolution: Fixed
-
P2
-
2.0, 7
-
b37
-
generic
-
generic
-
Verified
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
"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