javax.management.Notification#setUserData ( )源码实例Demo

下面列出了javax.management.Notification#setUserData ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u-jdk   文件: GarbageCollectorImpl.java
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);
}
 
源代码2 项目: TencentKona-8   文件: GarbageCollectorImpl.java
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);
}
 
源代码3 项目: TencentKona-8   文件: MemoryImpl.java
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);
}
 
源代码4 项目: jdk8u60   文件: GarbageCollectorImpl.java
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);
}
 
源代码5 项目: gemfirexd-oss   文件: CacheServerJmxImpl.java
/**
 * 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);
    }
  }
  
  LogWriterI18n logWriterI18n = 
    this.getDistributedSystem().getLogWriter().convertToLogWriterI18n();
  
  Notification notification = new Notification(NOTIF_REGION_LOST, 
                                  this.modelMBean, 
                                  Helper.getNextNotificationSequenceNumber(),
                                  Helper.getRegionEventDetails(event));
  
  notification.setUserData(event.getRegionPath());

  Helper.sendNotification(logWriterI18n, this, notification);
}
 
源代码6 项目: openjdk-8-source   文件: MemoryImpl.java
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);
}
 
源代码7 项目: openjdk-jdk8u   文件: GarbageCollectorImpl.java
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);
}
 
源代码8 项目: gemfirexd-oss   文件: SystemMemberJmxImpl.java
/**
 * 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);
    }
  }
  
  LogWriterI18n logWriterI18n = 
    this.getDistributedSystem().getLogWriter().convertToLogWriterI18n();
  
  Notification notification = new Notification(NOTIF_REGION_LOST, this.modelMBean, 
      Helper.getNextNotificationSequenceNumber(),
      Helper.getRegionEventDetails(event));
  
  notification.setUserData(event.getRegionPath());

  Helper.sendNotification(logWriterI18n, this, notification);
}
 
源代码9 项目: jdk8u-jdk   文件: MemoryImpl.java
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);
}
 
源代码10 项目: openjdk-8-source   文件: GarbageCollectorImpl.java
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);
}
 
源代码11 项目: jdk8u_jdk   文件: MemoryImpl.java
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);
}
 
源代码12 项目: gemfirexd-oss   文件: ManagementAdapter.java
/**
 * 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() + ")";

    Notification notification = new Notification(ResourceNotification.SYSTEM_ALERT, systemSource, SequenceNumber
        .next(), details.getMsgTime().getTime(), details.toString());
    InternalDistributedMember sender = details.getSender();
    String nameOrId = memberSource; // TODO Rishi/Abhishek - what if sender is
                                    // null?
    if (sender != null) {
      nameOrId = sender.getName();
      nameOrId = nameOrId != null && !nameOrId.trim().isEmpty() ? nameOrId : sender.getId();
    }
    notification.setUserData(nameOrId);
    service.handleNotification(notification);
  }

}
 
源代码13 项目: gemfirexd-oss   文件: SystemMemberJmxImpl.java
/**
 * 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) {
  LogWriterI18n logWriterI18n = 
    this.getDistributedSystem().getLogWriter().convertToLogWriterI18n();
  
  Notification notification = new Notification(NOTIF_REGION_CREATED, this.modelMBean, 
      Helper.getNextNotificationSequenceNumber(),
      Helper.getRegionEventDetails(event));
  
  notification.setUserData(event.getRegionPath());

  Helper.sendNotification(logWriterI18n, this, notification);
}
 
源代码14 项目: lams   文件: QuartzSchedulerMBeanImpl.java
/**
 * 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);
}
 
源代码15 项目: stratio-cassandra   文件: StreamEventJMXNotifier.java
public void onSuccess(StreamState result)
{
    Notification notif = new Notification(StreamEvent.class.getCanonicalName() + ".success",
                                          StreamManagerMBean.OBJECT_NAME,
                                          seq.getAndIncrement());
    notif.setUserData(StreamStateCompositeData.toCompositeData(result));
    sendNotification(notif);
}
 
源代码16 项目: openjdk-jdk9   文件: DiagnosticCommandImpl.java
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);
    }
 
源代码17 项目: stratio-cassandra   文件: StreamEventJMXNotifier.java
public void onFailure(Throwable t)
{
    Notification notif = new Notification(StreamEvent.class.getCanonicalName() + ".failure",
                                          StreamManagerMBean.OBJECT_NAME,
                                          seq.getAndIncrement());
    notif.setUserData(t.fillInStackTrace().toString());
    sendNotification(notif);
}
 
源代码18 项目: CloverETL-Engine   文件: CloverJMX.java
public void sendNotification(long runId, String type, String message, Object userData) {
	Notification notification = new Notification(type, MBEAN_NAME, 0); // CLO-13065: the sequence number will be set by JmxNotificationSender
	notification.setUserData(new JMXNotificationMessage(runId, userData));
	sendNotification(notification);
}
 
源代码19 项目: kieker   文件: KiekerJmxMonitoringLog.java
/**
 * Consumes the given record by sending a notification.
 * 
 * @param record
 *            The record to consume.
 * 
 * @return Always true.
 */
public final boolean newMonitoringRecord(final IMonitoringRecord record) {
	final Notification notification = new Notification(MESSAGE_TYPE, this.kiekerMonitoringLogName, 0L, 0L);
	notification.setUserData(record);
	super.sendNotification(notification);
	return true;
}
 
源代码20 项目: stratio-cassandra   文件: StorageService.java
/**
 * Sends JMX notification to subscribers.
 *
 * @param type Message type
 * @param message Message itself
 * @param userObject Arbitrary object to attach to notification
 */
public void sendNotification(String type, String message, Object userObject)
{
    Notification jmxNotification = new Notification(type, jmxObjectName, notificationSerialNumber.incrementAndGet(), message);
    jmxNotification.setUserData(userObject);
    sendNotification(jmxNotification);
}