Java Code Examples for javax.management.Notification.getUserData()

The following are Jave code examples for showing how to use getUserData() of the javax.management.Notification class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: monarch   File: DistributedSystemDUnitTest.java   View Source Code Vote up 5 votes
@Override
public synchronized void handleNotification(Notification notification, Object handback) {
  assertNotNull(notification);
  logger.info("Notification received {}", notification);
  Map<String, String> notifUserData = (Map<String, String>) notification.getUserData();
  if (notifUserData.get(JMXNotificationUserData.ALERT_LEVEL).equalsIgnoreCase("warning")) {
    assertEquals(WARNING_LEVEL_MESSAGE, notification.getMessage());
    ++warnigAlertCount;
  }
  if (notifUserData.get(JMXNotificationUserData.ALERT_LEVEL).equalsIgnoreCase("severe")) {
    assertEquals(SEVERE_LEVEL_MESSAGE, notification.getMessage());
    ++severAlertCount;
  }
}
 
Example 2
Project: jdk8u-jdk   File: MissingClassTest.java   View Source Code Vote up 4 votes
private static String notificationString(Notification n) {
    return n.getClass().getName() + "/" + n.getType() + " \"" +
        n.getMessage() + "\" <" + n.getUserData() + ">";
}
 
Example 3
Project: openjdk-jdk10   File: MissingClassTest.java   View Source Code Vote up 4 votes
private static String notificationString(Notification n) {
    return n.getClass().getName() + "/" + n.getType() + " \"" +
        n.getMessage() + "\" <" + n.getUserData() + ">";
}