javax.management.remote.TargetedNotification#getNotification ( )源码实例Demo

下面列出了javax.management.remote.TargetedNotification#getNotification ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk9   文件: NotificationBufferTest.java
private static boolean sameTargetedNotifs(TargetedNotification[] tn1,
                                          TargetedNotification[] tn2) {
    if (tn1.length != tn2.length) {
        System.out.println("Not same length");
        return false;
    }
    for (int i = 0; i < tn1.length; i++) {
        TargetedNotification n1 = tn1[i];
        TargetedNotification n2 = tn2[i];
        if (n1.getNotification() != n2.getNotification()
            || !n1.getListenerID().equals(n2.getListenerID()))
            return false;
    }
    return true;
}
 
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);
                    }
                }
            }
        }
    }
}
 
源代码3 项目: openjdk-8-source   文件: ServerNotifForwarder.java
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);
                    }
                }
            }
        }
    }
}
 
源代码4 项目: jdk8u-dev-jdk   文件: ServerNotifForwarder.java
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);
                    }
                }
            }
        }
    }
}
 
源代码5 项目: openjdk-jdk9   文件: ServerNotifForwarder.java
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);
                    }
                }
            }
        }
    }
}
 
源代码6 项目: TencentKona-8   文件: ClientNotifForwarder.java
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);
    }

}
 
源代码7 项目: TencentKona-8   文件: ServerNotifForwarder.java
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);
                    }
                }
            }
        }
    }
}
 
源代码8 项目: TencentKona-8   文件: NotificationBufferTest.java
private static boolean sameTargetedNotifs(TargetedNotification[] tn1,
                                          TargetedNotification[] tn2) {
    if (tn1.length != tn2.length) {
        System.out.println("Not same length");
        return false;
    }
    for (int i = 0; i < tn1.length; i++) {
        TargetedNotification n1 = tn1[i];
        TargetedNotification n2 = tn2[i];
        if (n1.getNotification() != n2.getNotification()
            || !n1.getListenerID().equals(n2.getListenerID()))
            return false;
    }
    return true;
}
 
源代码9 项目: jdk8u60   文件: ClientNotifForwarder.java
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);
    }

}
 
源代码10 项目: jdk8u-jdk   文件: ServerNotifForwarder.java
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);
                    }
                }
            }
        }
    }
}
 
源代码11 项目: hottub   文件: ClientNotifForwarder.java
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);
    }

}
 
源代码12 项目: JDKSourceCode1.8   文件: ClientNotifForwarder.java
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);
    }

}
 
源代码13 项目: hottub   文件: NotificationBufferTest.java
private static boolean sameTargetedNotifs(TargetedNotification[] tn1,
                                          TargetedNotification[] tn2) {
    if (tn1.length != tn2.length) {
        System.out.println("Not same length");
        return false;
    }
    for (int i = 0; i < tn1.length; i++) {
        TargetedNotification n1 = tn1[i];
        TargetedNotification n2 = tn2[i];
        if (n1.getNotification() != n2.getNotification()
            || !n1.getListenerID().equals(n2.getListenerID()))
            return false;
    }
    return true;
}
 
源代码14 项目: jdk8u-dev-jdk   文件: NotificationBufferTest.java
private static boolean sameTargetedNotifs(TargetedNotification[] tn1,
                                          TargetedNotification[] tn2) {
    if (tn1.length != tn2.length) {
        System.out.println("Not same length");
        return false;
    }
    for (int i = 0; i < tn1.length; i++) {
        TargetedNotification n1 = tn1[i];
        TargetedNotification n2 = tn2[i];
        if (n1.getNotification() != n2.getNotification()
            || !n1.getListenerID().equals(n2.getListenerID()))
            return false;
    }
    return true;
}
 
源代码15 项目: openjdk-jdk8u   文件: ServerNotifForwarder.java
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);
                    }
                }
            }
        }
    }
}
 
源代码16 项目: hottub   文件: ServerNotifForwarder.java
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);
                    }
                }
            }
        }
    }
}
 
源代码17 项目: jdk8u-jdk   文件: ClientNotifForwarder.java
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);
    }

}
 
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);
                    }
                }
            }
        }
    }
}
 
源代码19 项目: jdk8u_jdk   文件: NotificationBufferTest.java
private static boolean sameTargetedNotifs(TargetedNotification[] tn1,
                                          TargetedNotification[] tn2) {
    if (tn1.length != tn2.length) {
        System.out.println("Not same length");
        return false;
    }
    for (int i = 0; i < tn1.length; i++) {
        TargetedNotification n1 = tn1[i];
        TargetedNotification n2 = tn2[i];
        if (n1.getNotification() != n2.getNotification()
            || !n1.getListenerID().equals(n2.getListenerID()))
            return false;
    }
    return true;
}
 
源代码20 项目: openjdk-jdk9   文件: ClientNotifForwarder.java
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);
    }

}