javax.management.Notification.setUserData()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(70)

本文整理了Java中javax.management.Notification.setUserData()方法的一些代码示例,展示了Notification.setUserData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Notification.setUserData()方法的具体详情如下:
包路径:javax.management.Notification
类名称:Notification
方法名:setUserData

Notification.setUserData介绍

暂无

代码示例

代码示例来源:origin: quartz-scheduler/quartz

/**
 * 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);
}

代码示例来源:origin: log4j/log4j

public
void addAppenderEvent(Category logger, Appender appender) {
 log.debug("addAppenderEvent called: logger="+logger.getName()+
    ", appender="+appender.getName());
 Notification n = new Notification(ADD_APPENDER+logger.getName(), this, 0);
 n.setUserData(appender);
 log.debug("sending notification.");
 nbs.sendNotification(n);
}

代码示例来源:origin: apache/geode

@Override
public void handleNotification(Notification notification, Object handback) {
 NotificationKey key = new NotificationKey(name);
 notification.setUserData(memberSource);
 repo.putEntryInLocalNotificationRegion(key, notification);
}

代码示例来源:origin: apache/geode

notif.setUserData(notifBytes);
this.modelMBean.sendNotification(notif);

代码示例来源:origin: groovy/groovy-core

/**
 * Called to broadcast message on MBeanServer event bus.  Internally, it calls
 * NotificationBroadCasterSupport.sendNotification() method to dispatch the event.
 *
 * @param data - a data object sent as part of the event parameter.
 * @return a sequence number associated with the emitted event.
 */
public long send(Object data) {
  long seq = NumberSequencer.getNextSequence();
  Notification note = new Notification(
      this.getEvent(),
      this,
      seq,
      System.currentTimeMillis(),
      "Event notification " + this.getEvent()
  );
  note.setUserData(data);
  super.sendNotification(note);
  return seq;
}

代码示例来源:origin: apache/geode

/**
 * 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
 */
@Override
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);
}

代码示例来源:origin: apache/geode

/**
 * 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
 */
@Override
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);
}

代码示例来源:origin: apache/geode

/**
 * Sends the alert with the Object source as member. This notification will get filtered out for
 * particular alert level
 *
 */
protected 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);
 }
}

代码示例来源:origin: apache/geode

/**
  * 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
  */
 @Override
 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);
 }
}

代码示例来源:origin: apache/geode

/**
  * 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
  */
 @Override
 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);
 }
}

代码示例来源:origin: spring-projects/spring-integration

public Notification fromMessage(Message<?> message) {
  String type = resolveNotificationType(message);
  Assert.hasText(type, "No notification type header is available, and no default has been provided.");
  Object payload = message.getPayload();
  String notificationMessage = (payload instanceof String) ? (String) payload : null;
  Notification notification = new Notification(type, this.sourceObjectName,
      this.sequence.incrementAndGet(), System.currentTimeMillis(), notificationMessage);
  if (!(payload instanceof String)) {
    notification.setUserData(payload);
  }
  return notification;
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * 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);
}

代码示例来源:origin: apache/log4j

public
void addAppenderEvent(Category logger, Appender appender) {
 log.debug("addAppenderEvent called: logger="+logger.getName()+
    ", appender="+appender.getName());
 Notification n = new Notification(ADD_APPENDER+logger.getName(), this, 0);
 n.setUserData(appender);
 log.debug("sending notification.");
 nbs.sendNotification(n);
}

代码示例来源:origin: jsevellec/cassandra-unit

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);
  }
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

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);
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

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);
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

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);
}

代码示例来源:origin: apache/karaf

public void featureEvent(FeatureEvent event) {
  if (!event.isReplay()) {
    Notification notification = new Notification(FEATURE_EVENT_TYPE, objectName, sequenceNumber++);
    notification.setUserData(new JmxFeatureEvent(event).asCompositeData());
    sendNotification(notification);
  }
}

代码示例来源:origin: apache/karaf

public void repositoryEvent(RepositoryEvent event) {
  if (!event.isReplay()) {
    Notification notification = new Notification(REPOSITORY_EVENT_TYPE, objectName, sequenceNumber++);
    notification.setUserData(new JmxRepositoryEvent(event).asCompositeData());
    sendNotification(notification);
  }
}

代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j

public
void addAppenderEvent(Category logger, Appender appender) {
 log.debug("addAppenderEvent called: logger="+logger.getName()+
    ", appender="+appender.getName());
 Notification n = new Notification(ADD_APPENDER+logger.getName(), this, 0);
 n.setUserData(appender);
 log.debug("sending notification.");
 nbs.sendNotification(n);
}

相关文章