當前位置: 首頁>>代碼示例>>Java>>正文


Java Notification.setUserData方法代碼示例

本文整理匯總了Java中javax.management.Notification.setUserData方法的典型用法代碼示例。如果您正苦於以下問題:Java Notification.setUserData方法的具體用法?Java Notification.setUserData怎麽用?Java Notification.setUserData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.management.Notification的用法示例。


在下文中一共展示了Notification.setUserData方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createGCNotification

import javax.management.Notification; //導入方法依賴的package包/類
void createGCNotification(long timestamp,
                          String gcName,
                          String gcAction,
                          String gcCause,
                          GcInfo gcInfo)  {

    if (!hasListeners()) {
        return;
    }

    Notification notif = new Notification(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION,
                                          getObjectName(),
                                          getNextSeqNumber(),
                                          timestamp,
                                          gcName);
    GarbageCollectionNotificationInfo info =
        new GarbageCollectionNotificationInfo(gcName,
                                              gcAction,
                                              gcCause,
                                              gcInfo);

    CompositeData cd =
        GarbageCollectionNotifInfoCompositeData.toCompositeData(info);
    notif.setUserData(cd);
    sendNotification(notif);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:27,代碼來源:GarbageCollectorImpl.java

示例2: createNotification

import javax.management.Notification; //導入方法依賴的package包/類
static void createNotification(String notifType,
                               String poolName,
                               MemoryUsage usage,
                               long count) {
    MemoryImpl mbean = (MemoryImpl) ManagementFactory.getMemoryMXBean();
    if (!mbean.hasListeners()) {
        // if no listener is registered.
        return;
    }
    long timestamp = System.currentTimeMillis();
    String msg = getNotifMsg(notifType);
    Notification notif = new Notification(notifType,
                                          mbean.getObjectName(),
                                          getNextSeqNumber(),
                                          timestamp,
                                          msg);
    MemoryNotificationInfo info =
        new MemoryNotificationInfo(poolName,
                                   usage,
                                   count);
    CompositeData cd =
        MemoryNotifInfoCompositeData.toCompositeData(info);
    notif.setUserData(cd);
    mbean.sendNotification(notif);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:26,代碼來源:MemoryImpl.java

示例3: handleRegionLoss

import javax.management.Notification; //導入方法依賴的package包/類
/**
 * Implementation should handle loss of region by extracting the details from the given event
 * object and sending the {@link SystemMemberJmx#NOTIF_REGION_LOST} notification to the connected
 * JMX Clients. Region Path is set as User Data in Notification. Additionally, it also clears the
 * ManagedResources created for the region that is lost.
 * 
 * @param event event object corresponding to the loss of a region
 */
public void handleRegionLoss(SystemMemberRegionEvent event) {
  SystemMemberCacheJmxImpl cacheResource = this.managedSystemMemberCache;

  if (cacheResource != null) {
    ManagedResource cleanedUp = cacheResource.cleanupRegionResources(event.getRegionPath());

    if (cleanedUp != null) {
      MBeanUtil.unregisterMBean(cleanedUp);
    }
  }

  Notification notification = new Notification(NOTIF_REGION_LOST, this.modelMBean,
      Helper.getNextNotificationSequenceNumber(), Helper.getRegionEventDetails(event));

  notification.setUserData(event.getRegionPath());

  Helper.sendNotification(this, notification);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:27,代碼來源:SystemMemberJmxImpl.java

示例4: handleSystemNotification

import javax.management.Notification; //導入方法依賴的package包/類
/**
 * Sends the alert with the Object source as member. This notification will get filtered out for
 * particular alert level
 * 
 * @param details
 */
public void handleSystemNotification(AlertDetails details) {
  if (!isServiceInitialised("handleSystemNotification")) {
    return;
  }
  if (service.isManager()) {
    String systemSource = "DistributedSystem("
        + service.getDistributedSystemMXBean().getDistributedSystemId() + ")";
    Map<String, String> userData = prepareUserData(details);


    Notification notification = new Notification(JMXNotificationType.SYSTEM_ALERT, systemSource,
        SequenceNumber.next(), details.getMsgTime().getTime(), details.getMsg());

    notification.setUserData(userData);
    service.handleNotification(notification);
  }

}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:25,代碼來源:ManagementAdapter.java

示例5: createGCNotification

import javax.management.Notification; //導入方法依賴的package包/類
protected void createGCNotification(long timestamp,
                          String gcName,
                          String gcAction,
                          String gcCause,
                          GcInfo gcInfo)  {
    if (!hasListeners()) {
        return;
    }
    Notification notif = new Notification(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION,
                                          getObjectName(),
                                          getNextSeqNumber(),
                                          timestamp,
                                          gcName);
    GarbageCollectionNotificationInfo info =
        new GarbageCollectionNotificationInfo(gcName,
                                              gcAction,
                                              gcCause,
                                              gcInfo);

    CompositeData cd =
        GarbageCollectionNotifInfoCompositeData.toCompositeData(info);
    notif.setUserData(cd);
    sendNotification(notif);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:GarbageCollectorExtImpl.java

示例6: flagChanged

import javax.management.Notification; //導入方法依賴的package包/類
@Override
public void flagChanged(T changedValue) {
    Notification notification = new Notification(
            flagName,
            source,
            eventCounter++,
            changedValue.toString());
    notification.setUserData(flag.getFlag());
    nbs.sendNotification(notification);
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:11,代碼來源:JMXFlagDecorator.java

示例7: sendNotification

import javax.management.Notification; //導入方法依賴的package包/類
/**
 * sendNotification
 * 
 * @param eventType
 * @param data
 * @param msg
 */
public void sendNotification(String eventType, Object data, String msg) {
    Notification notif = new Notification(eventType, this, sequenceNumber
            .incrementAndGet(), System.currentTimeMillis(), msg);
    if (data != null) {
        notif.setUserData(data);
    }
    emitter.sendNotification(notif);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:QuartzSchedulerMBeanImpl.java

示例8: sendNotification

import javax.management.Notification; //導入方法依賴的package包/類
/**
 * sendNotification
 * 
 * @param eventType
 * @param data
 * @param msg
 */
public void sendNotification(String eventType, Object data, String msg) {
	Notification notif = new Notification(eventType, this, sequenceNumber
			.incrementAndGet(), System.currentTimeMillis(), msg);
	if (data != null) {
		notif.setUserData(data);
	}
	emitter.sendNotification(notif);
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:16,代碼來源:QuartzSchedulerMBeanImpl.java

示例9: handleRegionCreate

import javax.management.Notification; //導入方法依賴的package包/類
/**
 * Implementation handles creation of region by extracting the details from the given event object
 * and sending the {@link SystemMemberJmx#NOTIF_REGION_CREATED} notification to the connected JMX
 * Clients. Region Path is set as User Data in Notification.
 * 
 * @param event event object corresponding to the creation of a region
 */
public void handleRegionCreate(SystemMemberRegionEvent event) {
  Notification notification = new Notification(NOTIF_REGION_CREATED, this.modelMBean,
      Helper.getNextNotificationSequenceNumber(), Helper.getRegionEventDetails(event));

  notification.setUserData(event.getRegionPath());

  Helper.sendNotification(this, notification);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:16,代碼來源:SystemMemberJmxImpl.java

示例10: createDiagnosticFrameworkNotification

import javax.management.Notification; //導入方法依賴的package包/類
private void createDiagnosticFrameworkNotification() {

        if (!hasListeners()) {
            return;
        }
        ObjectName on = null;
        try {
            on = ObjectName.getInstance(PlatformMBeanProviderImpl.DIAGNOSTIC_COMMAND_MBEAN_NAME);
        } catch (MalformedObjectNameException e) { }
        Notification notif = new Notification("jmx.mbean.info.changed",
                                              on,
                                              getNextSeqNumber());
        notif.setUserData(getMBeanInfo());
        sendNotification(notif);
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:16,代碼來源:DiagnosticCommandImpl.java

示例11: doSendNotif

import javax.management.Notification; //導入方法依賴的package包/類
private synchronized void doSendNotif(String source, String msg, String userData) {
    Notification notif = new Notification(SS7_EVENT + "-" + source, "TesterHost", ++sequenceNumber,
            System.currentTimeMillis(), msg);
    notif.setUserData(userData);
    this.sendNotification(notif);
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:7,代碼來源:TesterHost.java

示例12: handleNotification

import javax.management.Notification; //導入方法依賴的package包/類
@Override
public void handleNotification(Notification notification, Object handback) {
  NotificationKey key = new NotificationKey(name);
  notification.setUserData(memberSource);
  repo.putEntryInLocalNotificationRegion(key, notification);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:7,代碼來源:NotificationHub.java


注:本文中的javax.management.Notification.setUserData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。