Interface NotificationManager


  • public interface NotificationManager
    A NotificationManager is responsible for JMX notification delivery from a managed node to a set of subscribing managing nodes.

    For Standard MBeans that implement the NotificationEmitter interface and Platform MBeans registered with the Coherence Registry, notifications will be automatically sent to the corresponding MBean within the Coherence domain (e.g. "Coherence:type=Platform,Domain=java.lang,subType=Memory,nodeId=1"). Additionally, application logic can send notifications using the NotificationManager as follows:

       Cluster             cluster  = CacheFactory.ensureCluster();
       Registry            registry = cluster.getManagement();
       NotificationManager manager  = registry.getNotificationManger();
       String              sName    = registry.ensureGlobalName("type=CustomMBean");
    
       if (manager.isSubscribedTo(sName))
          {
          manager.trigger(sName, "custom.notification.type", "Custom notification message");
          }
     

    Since:
    Coherence 3.6
    Author:
    ew 2010.02.05
    • Method Detail

      • isSubscribedTo

        boolean isSubscribedTo​(String sName)
        Determine if any subscriptions exist for the specified MBean.
        Parameters:
        sName - the MBean name to check for subscriptions
        Returns:
        true iff the specified name identifies the MBean that was registered by the caller's node and subscriptions exist for that MBean
      • trigger

        void trigger​(String sName,
                     String sType,
                     String sMessage)
              throws IllegalArgumentException
        Trigger the notification on subscribers for a given MBean.
        Parameters:
        sName - the MBean name
        sType - the notification type
        sMessage - the notification message
        Throws:
        IllegalArgumentException - if an MBean with the specified name does not exists
      • trigger

        void trigger​(String sName,
                     Notification notification)
              throws IllegalArgumentException
        Trigger the notification on subscribers for a given MBean.

        Note: if the specified Notification object has a negative SequenceNumber, it will be automatically assigned.

        Parameters:
        sName - the MBean name
        notification - the notification object
        Throws:
        IllegalArgumentException - if an MBean with the specified name does not exists