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

Mysterious behavior of EventClient methods unsubscribed and / or getListeners

XMLWordPrintable

    • b37
    • 7
    • generic
    • generic

      As of JDK 7 b37.
      This is possibly another flavor or a side effect of the 6759624.

      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);
          // SUBSCRIBE WITH SAME NAME AND PATTERN BUT NO FILTER NOR HANDBACK
          eventclient.subscribe(pattern, listener, null, null);
          // UNSUBSCRIBE WITH SAME NAME AND PATTERN
          eventclient.unsubscribe(pattern, listener);
          // ==> AT THAT POINT NO LISTENER SHOULD BE LISTED (am I right ?)
          // SUBSCRIBE AGAIN WITH SAME NAME, PATTERN, FILTER AND HANDBACK
          eventclient.subscribe(pattern, listener, filter, pattern);
          // CALL TO getListeners PRINTS:
          
      [SQE] *:*_javasoft.sqe.jmx.test.functional.EventClientTest2$SimpleListener@14d55de_javasoft.sqe.jmx.share.RankFilter@15fd251_*:*_true
      [SQE] *:*_javasoft.sqe.jmx.test.functional.EventClientTest2$SimpleListener@14d55de_null_null_true

      Why do I have 2 listeners listed ?
      Later on my listener doesn't receive notifications twice as it should if the two listeners listed above were really warm and alive.
      Does it mean the second one in the list is somewhat a hollow ?

            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: