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

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

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

Notification.toString介绍

暂无

代码示例

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

@Override
  public String toString() {
    return super.toString() + ", name=" + name;
  }
}

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

public void handleNotification(Notification note, Object handback) {
  System.out.println("Notification " + note.toString() + " received");
}

代码示例来源:origin: apache/activemq-artemis

@Override
  public String toString() {
    return super.toString() + ", name=" + name;
  }
}

代码示例来源:origin: apache/activemq-artemis

@Override
  public String toString() {
    return super.toString() + ", name=" + name;
  }
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
  public String toString() {
    return super.toString() + ", name=" + name;
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
  public String toString() {
    return super.toString() + ", name=" + name;
  }
}

代码示例来源:origin: io.snappydata/gemfire-hydra-tests

@Override
public void handleNotification(Notification notification, Object handback) {
 assertNotNull(notification);
 String notifStr = notification.toString();
 if (notifStr.contains("Warninglevel")) {
  ++warnigAlertCount;
 }
 if (notifStr.contains("Severelevel")) {
  ++severAlertCount;
 }
}

代码示例来源:origin: org.glassfish.main.common/amx-core

/**
Use of generic type form taking Class<T> is preferred.
 */
public static Serializable getAMXNotificationValue(final Notification notif, final String key) {
  final Map<String, Serializable> data =
      getAMXNotificationData(notif);
  if (data == null) {
    throw new IllegalArgumentException(notif.toString());
  }
  if (!data.containsKey(key)) {
    throw new IllegalArgumentException("Value not found for " + key
        + " in " + notif);
  }
  return data.get(key);
}

代码示例来源:origin: org.glassfish.common/amx-core

/**
Use of generic type form taking Class<T> is preferred.
 */
public static Serializable getAMXNotificationValue(final Notification notif, final String key) {
  final Map<String, Serializable> data =
      getAMXNotificationData(notif);
  if (data == null) {
    throw new IllegalArgumentException(notif.toString());
  }
  if (!data.containsKey(key)) {
    throw new IllegalArgumentException("Value not found for " + key
        + " in " + notif);
  }
  return data.get(key);
}

代码示例来源:origin: net.open-esb.core/esb-manage

/**
 * This is invoked when a JMX notification is received from an instance
 * Event Notifier MBean with which this MBean has registered as a
 * notification listener. If notifications are enabled, this resends the
 * notification without modification; otherwise, this does nothing.
 *
 * @param notification The notification object.
 * @param handback An object reference that was used when this MBean
 * registered as a listener with the instance Event Notifier MBean. In
 * this case, it is the instance name.
 */
public void handleNotification(Notification notification, Object handback)
{
  mLog.log(Level.FINER, "Received notification from instance {0}: {1}", new Object[]{(String) handback, notification.toString()});
  if ( mNotificationsEnabled )
  {
    mLog.finer("Forwarding notification");
    sendNotification(notification);
  }
}

代码示例来源:origin: io.snappydata/gemfire-hydra-tests

@Override
public void handleNotification(Notification notification, Object handback) {
 assertNotNull(notification);
 Notification rn =  notification;
 assertTrue(rn.getType().equals(ResourceNotification.REGION_CREATED)
   || rn.getType().equals(ResourceNotification.REGION_CLOSED));
 getLogWriter().info(
   "<ExpectedString> Member Level Notifications" + rn.toString()
     + "</ExpectedString> ");
}

代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core

/**
* Set the notification to be used as the data source. Load the hashmap 
* with all of the notification contents. Note that the keys are used 
* as attribute tags in the mapping resource file 
*
* @param n the notification to be used as data source at subsequent calls
*          of get()
**/    
public void prime(Notification n)
{
 // Get fixed event payload and general info
 this.payload.put(MESSAGE_TAG, n.getMessage());
 this.payload.put(SEQNO_TAG, new Long(n.getSequenceNumber()));
 this.payload.put(TSTAMP_TAG, new Long(n.getTimeStamp()));
 this.payload.put(TYPE_TAG, n.getType());
 this.payload.put(ALL_TAG, n.toString());
 this.payload.put(CLASS_TAG, n.getClass().getName());
 // Check if event contains anything in the user field. If there is, an
 // attempt is made to interpret it as a hash map and copy it. Note 
 // that previous content may be overwritten if the same keys as above 
 // are used
 Object userData = n.getUserData();
 if (userData instanceof Map) {
   // Copy all of the user data in the payload
   this.payload.putAll((Map)userData);    
 } else {
   this.payload.put(USERDATA_TAG, userData);
 }
} // prime

代码示例来源:origin: org.jboss.jbossas/jboss-snmp

/**
* Set the notification to be used as the data source. Load the hashmap 
* with all of the notification contents. Note that the keys are used 
* as attribute tags in the mapping resource file 
*
* @param n the notification to be used as data source at subsequent calls
*          of get()
**/    
public void prime(Notification n)
{
 // Get fixed event payload and general info
 this.payload.put(MESSAGE_TAG, n.getMessage());
 this.payload.put(SEQNO_TAG, new Long(n.getSequenceNumber()));
 this.payload.put(TSTAMP_TAG, new Long(n.getTimeStamp()));
 this.payload.put(TYPE_TAG, n.getType());
 this.payload.put(ALL_TAG, n.toString());
 this.payload.put(CLASS_TAG, n.getClass().getName());
 // Check if event contains anything in the user field. If there is, an
 // attempt is made to interpret it as a hash map and copy it. Note 
 // that previous content may be overwritten if the same keys as above 
 // are used
 Object userData = n.getUserData();
 if (userData instanceof Map) {
   // Copy all of the user data in the payload
   this.payload.putAll((Map)userData);    
 } else {
   this.payload.put(USERDATA_TAG, userData);
 }
} // prime

代码示例来源:origin: io.snappydata/gemfire-hydra-tests

@Override
public void handleNotification(Notification notification, Object handback) {
 assertNotNull(notification);
 getLogWriter().info("Expected String :" + notification.toString());
}

代码示例来源:origin: io.snappydata/gemfire-hydra-tests

@Override
public void handleNotification(Notification notification, Object handback) {
 assertNotNull(notification);
 Notification rn = notification;
 getLogWriter().info(
   "<ExpectedString> Distributed System Notifications" + rn.toString()
     + "</ExpectedString> ");
}

代码示例来源:origin: org.glassfish.main.common/amx-core

public void handleNotification(final Notification notifIn, final Object handback)
{
  if (!(notifIn instanceof MBeanServerNotification))
  {
    throw new IllegalArgumentException(notifIn.toString());
  }
  final MBeanServerNotification notif = (MBeanServerNotification) notifIn;
  final ObjectName objectName = notif.getMBeanName();
  final String type = notif.getType();
  final boolean matchesFilter = (mRegUnregFilter == null) ||
                 JMXUtil.matchesPattern(mDefaultDomain, mRegUnregFilter, objectName);
  if (matchesFilter)
  {
    if (type.equals(MBeanServerNotification.REGISTRATION_NOTIFICATION))
    {
      mbeanRegistered(objectName);
    }
    else if (type.equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION))
    {
      mbeanUnregistered(objectName);
    }
  }
}

代码示例来源:origin: org.glassfish.common/amx-core

public void handleNotification(final Notification notifIn, final Object handback)
{
  if (!(notifIn instanceof MBeanServerNotification))
  {
    throw new IllegalArgumentException(notifIn.toString());
  }
  final MBeanServerNotification notif = (MBeanServerNotification) notifIn;
  final ObjectName objectName = notif.getMBeanName();
  final String type = notif.getType();
  final boolean matchesFilter = (mRegUnregFilter == null) ||
                 JMXUtil.matchesPattern(mDefaultDomain, mRegUnregFilter, objectName);
  if (matchesFilter)
  {
    if (type.equals(MBeanServerNotification.REGISTRATION_NOTIFICATION))
    {
      mbeanRegistered(objectName);
    }
    else if (type.equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION))
    {
      mbeanUnregistered(objectName);
    }
  }
}

代码示例来源:origin: org.ow2.jonas/jonas-management-javaee

/**
   *
   * @param notif
   */
  protected void sendNotification(final Notification notif) {
    try {
      if (modelMBean != null) {
        modelMBean.sendNotification(notif);
      } else {
        logger.info("Can't send notification " + notif.toString());
      }
    } catch (RuntimeOperationsException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (MBeanException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: net.open-esb.core/framework-core

notif.setUserData(userData);
mLog.log(Level.FINER, "Sending notification: {0} sequence number {1}", new Object[]{notif.toString(), notif.getSequenceNumber()});
mExecSvc.execute(new Notify(this, notif));
return notif;

代码示例来源:origin: net.open-esb.core/framework-core

notif.setUserData(userData);
mLog.log(Level.FINER, "Sending notification: {0} sequence number {1}", new Object[]{notif.toString(), notif.getSequenceNumber()});
mExecSvc.execute(new Notify(this, notif));
return notif;

相关文章