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

@NotificationInfo does not create MBeanNotificationInfo in the MBean's MBeanInfo

XMLWordPrintable

    • 7
    • b42
    • generic
    • generic
    • Verified

      If one tries to register/create the following MBeans in the MBenServer and then invoke mbs.getMBeanInfo(name).getNotifications() - an empty array will be returned.

      1. A management interface is annotated with @NotificationInfo:
      --------------------------------------------------------------
          @NotificationInfo(types={"com.example.notifs.create",
                                   "com.example.notifs.destroy"})
          public interface CacheMBean {
               int getCachedNum();
          }

          public class Cache implements CacheMBean {

              public int getCachedNum() {
                  return 0;
              }
          }
      --------------------------------------------------------------

      2. An MBean implementation class is annotated with @NotificationInfo:
      --------------------------------------------------------------
          @MBean
          @NotificationInfo(types={"com.example.notifs.create",
                                   "com.example.notifs.destroy"})
          public class Cache {
              @Resource
              SendNotification sn;
          
              @ManagedOperation
              public int getCachedNum() {
                  return 0;
              }
          }
      --------------------------------------------------------------

            emcmanus Eamonn McManus
            ashusher Alexander Shusherov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: