本文整理汇总了Java中javax.management.Notification.getType方法的典型用法代码示例。如果您正苦于以下问题:Java Notification.getType方法的具体用法?Java Notification.getType怎么用?Java Notification.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.Notification
的用法示例。
在下文中一共展示了Notification.getType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleNotification
import javax.management.Notification; //导入方法依赖的package包/类
public synchronized void handleNotification(Notification notification,
Object handback) {
Utils.debug(Utils.DEBUG_STANDARD,
"SimpleListener::handleNotification :" + notification);
try {
received = true;
type = notification.getType();
this.handback = handback;
handbacks.add(handback);
nbrec++;
notify();
} catch(Exception e) {
System.out.println("(ERROR) SimpleListener::handleNotification :"
+ " Caught exception "
+ e) ;
}
}
示例2: handleNotification
import javax.management.Notification; //导入方法依赖的package包/类
public void handleNotification(Notification notification, Object handback) {
echo(">>> Received notification: " + notification);
if (notification instanceof MonitorNotification) {
String type = notification.getType();
if (type.equals(MonitorNotification.RUNTIME_ERROR)) {
MonitorNotification mn = (MonitorNotification) notification;
echo("\tType: " + mn.getType());
echo("\tTimeStamp: " + mn.getTimeStamp());
echo("\tObservedObject: " + mn.getObservedObject());
echo("\tObservedAttribute: " + mn.getObservedAttribute());
echo("\tDerivedGauge: " + mn.getDerivedGauge());
echo("\tTrigger: " + mn.getTrigger());
synchronized (this) {
messageReceived = true;
notifyAll();
}
}
}
}
示例3: handleNotification
import javax.management.Notification; //导入方法依赖的package包/类
@Override
public void handleNotification(Notification notification, Object handback) {
String nType = notification.getType();
String poolName
= CodeCacheUtils.getPoolNameFromNotification(notification);
// consider code cache events only
if (CodeCacheUtils.isAvailableCodeHeapPoolName(poolName)) {
Asserts.assertEQ(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED,
nType, "Unexpected event received: " + nType);
// receiving events from available CodeCache-related beans only
if (counters.get(poolName) != null) {
counters.get(poolName).incrementAndGet();
lastEventTimestamp = System.currentTimeMillis();
}
}
}
示例4: handleNotification
import javax.management.Notification; //导入方法依赖的package包/类
public void handleNotification(Notification notification, Object handback)
{
String notifType = notification.getType();
if(notifType.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED))
{
Log.logCritical("MEMORY_THRESHOLD_EXCEEDED:" + notification.getMessage() + " will try to unload some unused classes");
}
}
示例5: handleNotification
import javax.management.Notification; //导入方法依赖的package包/类
public void handleNotification(Notification n, Object hb) {
// treat the client notif to know the end
if (n instanceof JMXConnectionNotification) {
if (!JMXConnectionNotification.NOTIFS_LOST.equals(n.getType())) {
clientState = n.getType();
System.out.println(
">>> The client state has been changed to: "+clientState);
synchronized(lock) {
lock.notifyAll();
}
}
return;
}
System.out.println(">>> Do sleep to make reconnection.");
synchronized(lock) {
try {
lock.wait(listenerSleep);
} catch (Exception e) {
// OK
}
}
}
示例6: handleNotification
import javax.management.Notification; //导入方法依赖的package包/类
@Override
public void handleNotification(Notification notification, Object handback) {
String nType = notification.getType();
String poolName
= CodeCacheUtils.getPoolNameFromNotification(notification);
// consider code cache events only
if (CodeCacheUtils.isAvailableCodeHeapPoolName(poolName)) {
Asserts.assertEQ(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED,
nType, "Unexpected event received: " + nType);
if (poolName.equals(btype.getMemoryPool().getName())) {
counter++;
}
}
}
示例7: handleNotification
import javax.management.Notification; //导入方法依赖的package包/类
public void handleNotification(Notification notification, Object handback) {
try {
String notificationType = notification.getType();
LOGGER.trace("Streams Instance Notification: " + notification
+ "; User Data: " + notification.getUserData());
switch (notificationType) {
case AttributeChangeNotification.ATTRIBUTE_CHANGE:
AttributeChangeNotification acn = (AttributeChangeNotification) notification;
String attributeName = acn.getAttributeName();
if (attributeName.equals("Status")) {
InstanceMXBean.Status newValue = (InstanceMXBean.Status) acn
.getNewValue();
InstanceMXBean.Status oldValue = (InstanceMXBean.Status) acn
.getOldValue();
LOGGER.info("Streams Instance Status Changed from: " + oldValue
+ " to: " + newValue);
this.instanceInfo.setInstanceStatus((InstanceMXBean.Status) acn
.getNewValue());
if (newValue.equals(InstanceMXBean.Status.STOPPED)
|| newValue.equals(InstanceMXBean.Status.FAILED)
|| newValue.equals(InstanceMXBean.Status.UNKNOWN)) {
LOGGER.info("Instance Status reflects not availabe status ("
+ newValue
+ "), monitor will reset and reinitialize when instance is available");
this.instanceInfo.setInstanceStartTime(null);
resetTracker();
clearTracker();
metricsExporter.getStreamsMetric("status", StreamsObjectType.INSTANCE, this.domainName, this.instanceInfo.getInstanceName()).set(getInstanceStatusAsMetric());
}
}
break;
case Notifications.INSTANCE_DELETED:
LOGGER.debug("Instance deleted from domain, resetting monitor and waiting for instance to be recreated");
this.instanceInfo.setInstanceExists(false);
resetTracker();
clearTracker();
break;
case Notifications.JOB_ADDED:
LOGGER.debug("****** Job add notification, Jobid : "
+ notification.getUserData());
addJobToMap((BigInteger) notification.getUserData());
break;
case Notifications.JOB_REMOVED:
LOGGER.debug("******** Job removed notification, userData: "
+ notification.getUserData());
// We are only listening on Straems Instance, so user data is a
// jobid
removeJobFromMap((BigInteger) notification.getUserData());
break;
}
} catch (Exception e) {
LOGGER.error("Instance Notification Handler caught exception: {}",e.toString());
e.printStackTrace();
}
}
示例8: notificationString
import javax.management.Notification; //导入方法依赖的package包/类
private static String notificationString(Notification n) {
return n.getClass().getName() + "/" + n.getType() + " \"" +
n.getMessage() + "\" <" + n.getUserData() + ">";
}