當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。