当前位置: 首页>>代码示例>>Java>>正文


Java Notification.getType方法代码示例

本文整理汇总了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) ;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:SimpleListener.java

示例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();
            }
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:RuntimeExceptionTest.java

示例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();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:PoolsIndependenceTest.java

示例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");
	}  
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:9,代码来源:CodeSizeLimitEventHandler.java

示例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
                    }
                }
            }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:NotifReconnectDeadlockTest.java

示例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++;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:ThresholdNotificationsTest.java

示例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();
	}
}
 
开发者ID:IBMStreams,项目名称:streamsx.jmxclients,代码行数:57,代码来源:StreamsInstanceTracker.java

示例8: notificationString

import javax.management.Notification; //导入方法依赖的package包/类
private static String notificationString(Notification n) {
    return n.getClass().getName() + "/" + n.getType() + " \"" +
        n.getMessage() + "\" <" + n.getUserData() + ">";
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:5,代码来源:MissingClassTest.java


注:本文中的javax.management.Notification.getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。