本文整理汇总了Java中javax.management.remote.JMXConnectionNotification.getType方法的典型用法代码示例。如果您正苦于以下问题:Java JMXConnectionNotification.getType方法的具体用法?Java JMXConnectionNotification.getType怎么用?Java JMXConnectionNotification.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.remote.JMXConnectionNotification
的用法示例。
在下文中一共展示了JMXConnectionNotification.getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleNotification
import javax.management.remote.JMXConnectionNotification; //导入方法依赖的package包/类
@Override
public void handleNotification(Notification notification,
Object handback) {
JMXConnectionNotification connectionNotification = (JMXConnectionNotification) notification;
// Should handle connectionID in the future to be specific
// Be aware!! JMX failures log SEVERE messages that are not
// coming from us
LOGGER.trace("*** JMX Connection Notification: "
+ connectionNotification);
LOGGER.trace("*** notification.getConnectionId(): "
+ connectionNotification.getConnectionId());
LOGGER.trace("*** this.notificationId: " + mConnectionId);
// Only reset connection if the notification is for the
// connection at this endpoint
if (!connectionNotification.getConnectionId().equals(
mConnectionId)) {
return;
}
String notificationType = connectionNotification.getType();
if (notificationType
.equals(JMXConnectionNotification.NOTIFS_LOST)
|| notificationType
.equals(JMXConnectionNotification.CLOSED)
|| notificationType
.equals(JMXConnectionNotification.FAILED)) {
LOGGER.warn("*** Lost JMX Connection, scheduling reconnect and removing connection listener ...");
// Remove connectionListener becuase often FAILED is follwed
// by CLOSED and was causing multiple reconnects which stomp
// on each other
removeNotificationListener();
notifyBeanSourceInterrupted(mStreamsBeanSource);
// Could test to ensure we want to try and reconnect
scheduleReconnect();
}
}
示例2: handleNotification
import javax.management.remote.JMXConnectionNotification; //导入方法依赖的package包/类
@Override
public void handleNotification(Notification notification, Object handback) {
if (notification instanceof JMXConnectionNotification) {
JMXConnectionNotification cxNotification = (JMXConnectionNotification) notification;
String type = cxNotification.getType();
if (JMXConnectionNotification.CLOSED.equals(type)) {
this.securityService.logout();
}
}
}