ConnectionTest.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
private static boolean
    mustBeConnectionNotification(Notification notif,
                                 String requiredConnId,
                                 String requiredType) {

    if (!(notif instanceof JMXConnectionNotification)) {
        System.out.println("Should have been a " +
                           "JMXConnectionNotification: " +
                           notif.getClass());
        return false;
    }

    JMXConnectionNotification cnotif = (JMXConnectionNotification) notif;
    if (!cnotif.getType().equals(requiredType)) {
        System.out.println("Wrong type notif: is \"" + cnotif.getType() +
                           "\", should be \"" + requiredType + "\"");
        return false;
    }

    if (!cnotif.getConnectionId().equals(requiredConnId)) {
        System.out.println("Wrong connection id: is \"" +
                           cnotif.getConnectionId() + "\", should be \"" +
                           requiredConnId);
        return false;
    }

    return true;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号