Java Code Examples for javax.management.Notification#getSource()

The following examples show how to use javax.management.Notification#getSource() . 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: NotificationEmissionTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
Example 2
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 3
Source File: DefaultMBeanServerInterceptor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 4
Source File: NotificationEmissionTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
Example 5
Source File: NotificationEmissionTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
Example 6
Source File: NotificationEmissionTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
Example 7
Source File: NotificationAccessControllerTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check received notifications
 */
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
Example 8
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void handleNotification(Notification notification,
                               Object handback) {
    if (notification != null) {
        if (notification.getSource() == mbean)
            notification.setSource(name);
    }

    /*
     * Listeners are not supposed to throw exceptions.  If
     * this one does, we could remove it from the MBean.  It
     * might indicate that a connector has stopped working,
     * for instance, and there is no point in sending future
     * notifications over that connection.  However, this
     * seems rather drastic, so instead we propagate the
     * exception and let the broadcaster handle it.
     */
    listener.handleNotification(notification, handback);
}
 
Example 9
Source File: NotificationAccessControllerTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check received notifications
 */
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
Example 10
Source File: NotificationAccessControllerTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check received notifications
 */
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
Example 11
Source File: NotificationEmissionTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
Example 12
Source File: NotificationAccessControllerTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check received notifications
 */
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
Example 13
Source File: NotificationAccessControllerTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check received notifications
 */
public int checkNotifs(int size,
                       List<Notification> received,
                       List<ObjectName> expected) {
    if (received.size() != size) {
        echo("Error: expecting " + size + " notifications, got " +
                received.size());
        return 1;
    } else {
        for (Notification n : received) {
            echo("Received notification: " + n);
            if (!n.getType().equals("nb")) {
                echo("Notification type must be \"nb\"");
                return 1;
            }
            ObjectName o = (ObjectName) n.getSource();
            int index = (int) n.getSequenceNumber();
            ObjectName nb = expected.get(index);
            if (!o.equals(nb)) {
                echo("Notification source must be " + nb);
                return 1;
            }
        }
    }
    return 0;
}
 
Example 14
Source File: OldMBeanServerTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 15
Source File: OldMBeanServerTest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 16
Source File: OldMBeanServerTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 17
Source File: OldMBeanServerTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 18
Source File: OldMBeanServerTest.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 19
Source File: OldMBeanServerTest.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}
 
Example 20
Source File: OldMBeanServerTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void handleNotification(
        Notification notification, Object handback) {
    if (notification.getSource() == userMBean)
        notification.setSource(name);
    userListener.handleNotification(notification, handback);
}