Java Code Examples for javax.management.remote.TargetedNotification#getListenerID()

The following examples show how to use javax.management.remote.TargetedNotification#getListenerID() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServerNotifForwarder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
Example 2
Source File: ServerNotifForwarder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
Example 3
Source File: ClientNotifForwarder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void dispatchNotification(TargetedNotification tn,
                          Integer myListenerID,
                          Map<Integer, ClientListenerInfo> listeners) {
    final Notification notif = tn.getNotification();
    final Integer listenerID = tn.getListenerID();

    if (listenerID.equals(myListenerID)) return;
    final ClientListenerInfo li = listeners.get(listenerID);

    if (li == null) {
        logger.trace("NotifFetcher.dispatch",
                     "Listener ID not in map");
        return;
    }

    NotificationListener l = li.getListener();
    Object h = li.getHandback();
    try {
        l.handleNotification(notif, h);
    } catch (RuntimeException e) {
        final String msg =
            "Failed to forward a notification " +
            "to a listener";
        logger.trace("NotifFetcher-run", msg, e);
    }

}
 
Example 4
Source File: ServerNotifForwarder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
Example 5
Source File: ClientNotifForwarder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
void dispatchNotification(TargetedNotification tn,
                          Integer myListenerID,
                          Map<Integer, ClientListenerInfo> listeners) {
    final Notification notif = tn.getNotification();
    final Integer listenerID = tn.getListenerID();

    if (listenerID.equals(myListenerID)) return;
    final ClientListenerInfo li = listeners.get(listenerID);

    if (li == null) {
        logger.trace("NotifFetcher.dispatch",
                     "Listener ID not in map");
        return;
    }

    NotificationListener l = li.getListener();
    Object h = li.getHandback();
    try {
        l.handleNotification(notif, h);
    } catch (RuntimeException e) {
        final String msg =
            "Failed to forward a notification " +
            "to a listener";
        logger.trace("NotifFetcher-run", msg, e);
    }

}
 
Example 6
Source File: ClientNotifForwarder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
void dispatchNotification(TargetedNotification tn,
                          Integer myListenerID,
                          Map<Integer, ClientListenerInfo> listeners) {
    final Notification notif = tn.getNotification();
    final Integer listenerID = tn.getListenerID();

    if (listenerID.equals(myListenerID)) return;
    final ClientListenerInfo li = listeners.get(listenerID);

    if (li == null) {
        logger.trace("NotifFetcher.dispatch",
                     "Listener ID not in map");
        return;
    }

    NotificationListener l = li.getListener();
    Object h = li.getHandback();
    try {
        l.handleNotification(notif, h);
    } catch (RuntimeException e) {
        final String msg =
            "Failed to forward a notification " +
            "to a listener";
        logger.trace("NotifFetcher-run", msg, e);
    }

}
 
Example 7
Source File: ClientNotifForwarder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void dispatchNotification(TargetedNotification tn,
                          Integer myListenerID,
                          Map<Integer, ClientListenerInfo> listeners) {
    final Notification notif = tn.getNotification();
    final Integer listenerID = tn.getListenerID();

    if (listenerID.equals(myListenerID)) return;
    final ClientListenerInfo li = listeners.get(listenerID);

    if (li == null) {
        logger.trace("NotifFetcher.dispatch",
                     "Listener ID not in map");
        return;
    }

    NotificationListener l = li.getListener();
    Object h = li.getHandback();
    try {
        l.handleNotification(notif, h);
    } catch (RuntimeException e) {
        final String msg =
            "Failed to forward a notification " +
            "to a listener";
        logger.trace("NotifFetcher-run", msg, e);
    }

}
 
Example 8
Source File: ServerNotifForwarder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
Example 9
Source File: ClientNotifForwarder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
void dispatchNotification(TargetedNotification tn,
                          Integer myListenerID,
                          Map<Integer, ClientListenerInfo> listeners) {
    final Notification notif = tn.getNotification();
    final Integer listenerID = tn.getListenerID();

    if (listenerID.equals(myListenerID)) return;
    final ClientListenerInfo li = listeners.get(listenerID);

    if (li == null) {
        logger.trace("NotifFetcher.dispatch",
                     "Listener ID not in map");
        return;
    }

    NotificationListener l = li.getListener();
    Object h = li.getHandback();
    try {
        l.handleNotification(notif, h);
    } catch (RuntimeException e) {
        final String msg =
            "Failed to forward a notification " +
            "to a listener";
        logger.trace("NotifFetcher-run", msg, e);
    }

}
 
Example 10
Source File: ServerNotifForwarder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
Example 11
Source File: ServerNotifForwarder.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
Example 12
Source File: ServerNotifForwarder.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
Example 13
Source File: ServerNotifForwarder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
Example 14
Source File: ClientNotifForwarder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void dispatchNotification(TargetedNotification tn,
                          Integer myListenerID,
                          Map<Integer, ClientListenerInfo> listeners) {
    final Notification notif = tn.getNotification();
    final Integer listenerID = tn.getListenerID();

    if (listenerID.equals(myListenerID)) return;
    final ClientListenerInfo li = listeners.get(listenerID);

    if (li == null) {
        logger.trace("NotifFetcher.dispatch",
                     "Listener ID not in map");
        return;
    }

    NotificationListener l = li.getListener();
    Object h = li.getHandback();
    try {
        l.handleNotification(notif, h);
    } catch (RuntimeException e) {
        final String msg =
            "Failed to forward a notification " +
            "to a listener";
        logger.trace("NotifFetcher-run", msg, e);
    }

}
 
Example 15
Source File: ClientNotifForwarder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void dispatchNotification(TargetedNotification tn,
                          Integer myListenerID,
                          Map<Integer, ClientListenerInfo> listeners) {
    final Notification notif = tn.getNotification();
    final Integer listenerID = tn.getListenerID();

    if (listenerID.equals(myListenerID)) return;
    final ClientListenerInfo li = listeners.get(listenerID);

    if (li == null) {
        logger.trace("NotifFetcher.dispatch",
                     "Listener ID not in map");
        return;
    }

    NotificationListener l = li.getListener();
    Object h = li.getHandback();
    try {
        l.handleNotification(notif, h);
    } catch (RuntimeException e) {
        final String msg =
            "Failed to forward a notification " +
            "to a listener";
        logger.trace("NotifFetcher-run", msg, e);
    }

}
 
Example 16
Source File: ServerNotifForwarder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
Example 17
Source File: ClientNotifForwarder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void dispatchNotification(TargetedNotification tn,
                          Integer myListenerID,
                          Map<Integer, ClientListenerInfo> listeners) {
    final Notification notif = tn.getNotification();
    final Integer listenerID = tn.getListenerID();

    if (listenerID.equals(myListenerID)) return;
    final ClientListenerInfo li = listeners.get(listenerID);

    if (li == null) {
        logger.trace("NotifFetcher.dispatch",
                     "Listener ID not in map");
        return;
    }

    NotificationListener l = li.getListener();
    Object h = li.getHandback();
    try {
        l.handleNotification(notif, h);
    } catch (RuntimeException e) {
        final String msg =
            "Failed to forward a notification " +
            "to a listener";
        logger.trace("NotifFetcher-run", msg, e);
    }

}
 
Example 18
Source File: ServerNotifForwarder.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}
 
Example 19
Source File: ClientNotifForwarder.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
void dispatchNotification(TargetedNotification tn,
                          Integer myListenerID,
                          Map<Integer, ClientListenerInfo> listeners) {
    final Notification notif = tn.getNotification();
    final Integer listenerID = tn.getListenerID();

    if (listenerID.equals(myListenerID)) return;
    final ClientListenerInfo li = listeners.get(listenerID);

    if (li == null) {
        logger.trace("NotifFetcher.dispatch",
                     "Listener ID not in map");
        return;
    }

    NotificationListener l = li.getListener();
    Object h = li.getHandback();
    try {
        l.handleNotification(notif, h);
    } catch (RuntimeException e) {
        final String msg =
            "Failed to forward a notification " +
            "to a listener";
        logger.trace("NotifFetcher-run", msg, e);
    }

}
 
Example 20
Source File: ServerNotifForwarder.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void snoopOnUnregister(NotificationResult nr) {
    List<IdAndFilter> copy = null;
    synchronized (listenerMap) {
        Set<IdAndFilter> delegateSet = listenerMap.get(MBeanServerDelegate.DELEGATE_NAME);
        if (delegateSet == null || delegateSet.isEmpty()) {
            return;
        }
        copy = new ArrayList<>(delegateSet);
    }

    for (TargetedNotification tn : nr.getTargetedNotifications()) {
        Integer id = tn.getListenerID();
        for (IdAndFilter idaf : copy) {
            if (idaf.id == id) {
                // This is a notification from the MBeanServerDelegate.
                Notification n = tn.getNotification();
                if (n instanceof MBeanServerNotification &&
                        n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                    MBeanServerNotification mbsn = (MBeanServerNotification) n;
                    ObjectName gone = mbsn.getMBeanName();
                    synchronized (listenerMap) {
                        listenerMap.remove(gone);
                    }
                }
            }
        }
    }
}