当前位置: 首页>>代码示例>>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;未经允许,请勿转载。