本文整理了Java中javax.management.AttributeChangeNotification.getNewValue()
方法的一些代码示例,展示了AttributeChangeNotification.getNewValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AttributeChangeNotification.getNewValue()
方法的具体详情如下:
包路径:javax.management.AttributeChangeNotification
类名称:AttributeChangeNotification
方法名:getNewValue
暂无
代码示例来源:origin: groovy/groovy-core
private static Map buildAttributeNotificationPacket(AttributeChangeNotification note) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("oldValue", note.getOldValue());
result.put("newValue", note.getNewValue());
result.put("attribute", note.getAttributeName());
result.put("attributeType", note.getAttributeType());
result.put("sequenceNumber", note.getSequenceNumber());
result.put("timeStamp", note.getTimeStamp());
return result;
}
}
代码示例来源:origin: mercyblitz/segmentfault-lessons
/**
* 处理通知/事件
*
* @param notification
* @param handback
*/
@Override
public void handleNotification(Notification notification, Object handback) {
AttributeChangeNotification attributeChangeNotification = (AttributeChangeNotification) notification;
String oldData = (String) attributeChangeNotification.getOldValue();
String newData = (String) attributeChangeNotification.getNewValue();
System.out.printf("The notification of data's attribute - old data : %s , new data : %s \n", oldData, newData);
}
代码示例来源:origin: mx4j/mx4j-tools
public void handleNotification(Notification notification, Object object)
{
AttributeChangeNotification anot = (AttributeChangeNotification)notification;
addEntry(new Date(), (Number)anot.getNewValue());
}
代码示例来源:origin: io.github.benas.cb4j/cb4j-tools
/**
* {@inheritDoc}
*/
public void handleNotification(Notification notification, Object handback) {
if (notification instanceof AttributeChangeNotification) {
AttributeChangeNotification acn = (AttributeChangeNotification) notification;
BatchReport batchReport = (BatchReport)acn.getNewValue();
this.batchReport = batchReport;
printProgress(batchReport);
}
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-cluster
public void handleNotification (Notification notification, java.lang.Object handback)
{
if (notification instanceof AttributeChangeNotification)
{
AttributeChangeNotification notif = (AttributeChangeNotification) notification;
int value = ((Integer)notif.getNewValue()).intValue ();
// Start management is handled by the ProxyFactoryHA, not here
if (value == ServiceMBean.STOPPING)
{
containerIsAboutToStop ();
}
}
}
代码示例来源:origin: io.github.benas.cb4j/cb4j-tools
/**
* {@inheritDoc}
*/
public void handleNotification(Notification notification, Object handback) {
if (notification instanceof AttributeChangeNotification) {
AttributeChangeNotification acn = (AttributeChangeNotification) notification;
BatchReport batchReport = (BatchReport)acn.getNewValue();
this.batchReport = batchReport;
cb4JMonitor.update(batchReport);
}
}
代码示例来源:origin: org.apache.camel/camel-jmx
@Override
public boolean isNotificationEnabled(Notification notification) {
boolean enabled = super.isNotificationEnabled(notification);
if (!enabled) {
return false;
}
boolean match = false;
if (stringToCompare != null) {
AttributeChangeNotification acn = (AttributeChangeNotification) notification;
Object newValue = acn.getNewValue();
// special for null
if ("null".equals(stringToCompare) && newValue == null) {
match = true;
} else if (newValue != null) {
match = stringToCompare.equals(newValue.toString());
}
return notifyMatch == match;
} else {
return true;
}
}
代码示例来源:origin: commons-modeler/commons-modeler
public String dumpStatus() throws Exception
{
StringBuffer sb=new StringBuffer();
Enumeration en=instances.keys();
while (en.hasMoreElements()) {
String on = (String) en.nextElement();
Object mbean=instances.get(on);
Hashtable mbeanAtt=(Hashtable)attributes.get(mbean);
sb.append( "<mbean class=\"").append(on).append("\">");
sb.append( "\n");
Enumeration attEn=mbeanAtt.keys();
while (attEn.hasMoreElements()) {
String an = (String) attEn.nextElement();
AttributeChangeNotification anotif=
(AttributeChangeNotification)mbeanAtt.get(an);
sb.append(" <attribute name=\"").append(an).append("\" ");
sb.append("value=\"").append(anotif.getNewValue()).append("\">");
sb.append( "\n");
}
sb.append( "</mbean>");
sb.append( "\n");
}
return sb.toString();
}
代码示例来源:origin: org.kohsuke.droovy/groovy
private static Map buildAttributeNotificationPacket(AttributeChangeNotification note) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("oldValue", note.getOldValue());
result.put("newValue", note.getNewValue());
result.put("attribute", note.getAttributeName());
result.put("attributeType", note.getAttributeType());
result.put("sequenceNumber", note.getSequenceNumber());
result.put("timeStamp", note.getTimeStamp());
return result;
}
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
private static Map buildAttributeNotificationPacket(AttributeChangeNotification note) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("oldValue", note.getOldValue());
result.put("newValue", note.getNewValue());
result.put("attribute", note.getAttributeName());
result.put("attributeType", note.getAttributeType());
result.put("sequenceNumber", note.getSequenceNumber());
result.put("timeStamp", note.getTimeStamp());
return result;
}
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-cluster
public void handleNotification (Notification notification, java.lang.Object handback)
{
if (notification instanceof AttributeChangeNotification)
{
AttributeChangeNotification notif = (AttributeChangeNotification) notification;
int value = ((Integer)notif.getNewValue()).intValue ();
if (value == ServiceMBean.STARTED)
{
log.debug ("Container fully started: enabling HA-RMI access to bean");
containerIsFullyStarted ();
}
else if (value == ServiceMBean.STOPPING)
{
log.debug ("Container about to stop: disabling HA-RMI access to bean");
containerIsAboutToStop ();
}
}
}
代码示例来源:origin: org.codehaus.groovy/groovy-jmx
private static Map buildAttributeNotificationPacket(AttributeChangeNotification note) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("oldValue", note.getOldValue());
result.put("newValue", note.getNewValue());
result.put("attribute", note.getAttributeName());
result.put("attributeType", note.getAttributeType());
result.put("sequenceNumber", note.getSequenceNumber());
result.put("timeStamp", note.getTimeStamp());
return result;
}
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
private static Map buildAttributeNotificationPacket(AttributeChangeNotification note) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("oldValue", note.getOldValue());
result.put("newValue", note.getNewValue());
result.put("attribute", note.getAttributeName());
result.put("attributeType", note.getAttributeType());
result.put("sequenceNumber", note.getSequenceNumber());
result.put("timeStamp", note.getTimeStamp());
return result;
}
}
代码示例来源:origin: com.github.nyla-solutions/nyla.solutions.core
public void handleNotification(Notification notification,
Object handback) {
System.out.println("\nReceived notification:");
System.out.println("\tClassName: " + notification.getClass().getName());
System.out.println("\tSource: " + notification.getSource());
System.out.println("\tType: " + notification.getType());
System.out.println("\tMessage: " + notification.getMessage());
if (notification instanceof AttributeChangeNotification) {
AttributeChangeNotification acn =
(AttributeChangeNotification) notification;
System.out.println("\tAttributeName: " + acn.getAttributeName());
System.out.println("\tAttributeType: " + acn.getAttributeType());
System.out.println("\tNewValue: " + acn.getNewValue());
System.out.println("\tOldValue: " + acn.getOldValue());
}
}
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public void handleNotification(Notification notification, Object handback) {
switch (server) {
case 0: { // handle WebLogic notification
if (notification instanceof AttributeChangeNotification) {
AttributeChangeNotification acn = (AttributeChangeNotification) notification;
if (acn.getAttributeName().equals(WLS_ACTIVE_VERSION_STATE)) {
if (acn.getNewValue().equals(0)) {
resetHelperContext(appName);
}
}
}
break;
}
case 1: { // handle JBoss notification
// assumes 'user data' is an ObjectName containing an 'id' property which indicates the archive file name
appName = getApplicationNameFromJBossClassLoader(((ObjectName) notification.getUserData()).getKeyProperty(JBOSS_ID_KEY));
// we receive notifications for all service stops in JBoss; only call reset if necessary
if (helperContexts.containsKey(appName)) {
resetHelperContext(appName);
}
break;
}
}
}
}
代码示例来源:origin: io.takari.nexus/nexus-perf
public Agent(final JMXServiceURL jmxServiceURL) {
this.jmxServiceURL = jmxServiceURL;
try {
log.info("Connecting to {}...", jmxServiceURL);
JMXConnector connector = JMXConnectorFactory.connect(jmxServiceURL, null);
connection = connector.getMBeanServerConnection();
ObjectName controlBeanName = new ObjectName(PerformanceTestMBean.class.getPackage().getName(), "name", "control");
controlBean = JMX.newMBeanProxy(connection, controlBeanName, PerformanceTestMBean.class, false);
connection.addNotificationListener(controlBeanName, (notification, handback) -> {
if (notification instanceof AttributeChangeNotification) {
AttributeChangeNotification acn = (AttributeChangeNotification) notification;
if ("running".equals(acn.getAttributeName())
&& Boolean.FALSE.equals(acn.getNewValue()) && Boolean.TRUE.equals(acn.getOldValue())) {
if (finishSignal != null) {
finishSignal.countDown();
}
}
}
}, null, null);
}
catch (Exception e) {
log.debug("Could not connect to {}: {}", jmxServiceURL, e.toString());
throw Throwables.propagate(e);
}
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-cluster
public void handleNotification (Notification notification, Object handback)
{
if (notification instanceof AttributeChangeNotification)
{
AttributeChangeNotification notif = (AttributeChangeNotification) notification;
state = ((Integer)notif.getNewValue()).intValue();
if (state == ServiceMBean.STARTED)
{
log.debug ("Started: enabling remote access to mbean " + getTargetName());
containerIsFullyStarted ();
}
else if (state == ServiceMBean.STOPPING)
{
log.debug ("About to stop: disabling remote access to mbean " + getTargetName());
containerIsAboutToStop ();
}
}
}
代码示例来源:origin: org.glassfish.main.common/amx-core
public String stringify(Object o)
{
final AttributeChangeNotification notif = (AttributeChangeNotification) o;
final StringBuffer b = super._stringify(notif);
append(b, "");
final String attrName = notif.getAttributeName();
final String oldValue = SmartStringifier.toString(notif.getOldValue());
final String newValue = SmartStringifier.toString(notif.getNewValue());
final String msg = attrName + ": " + oldValue + " => " + newValue;
b.append(msg);
return (b.toString());
}
代码示例来源:origin: org.glassfish.common/amx-core
public String stringify(Object o)
{
final AttributeChangeNotification notif = (AttributeChangeNotification) o;
final StringBuffer b = super._stringify(notif);
append(b, "");
final String attrName = notif.getAttributeName();
final String oldValue = SmartStringifier.toString(notif.getOldValue());
final String newValue = SmartStringifier.toString(notif.getNewValue());
final String msg = attrName + ": " + oldValue + " => " + newValue;
b.append(msg);
return (b.toString());
}
代码示例来源:origin: org.easybatch/easybatch-core
/**
* {@inheritDoc}
*/
public void handleNotification(Notification notification, Object handback) {
if (notification instanceof AttributeChangeNotification) {
AttributeChangeNotification attributeChangeNotification = (AttributeChangeNotification) notification;
JobReport jobReport = (JobReport)attributeChangeNotification.getNewValue();
onJobReportUpdate(jobReport);
}
if (notification instanceof JMXConnectionNotification) {
JMXConnectionNotification jmxConnectionNotification = (JMXConnectionNotification) notification;
String type = jmxConnectionNotification.getType();
switch (type) {
case JMXConnectionNotification.OPENED: onConnectionOpened(); break;
case JMXConnectionNotification.CLOSED: onConnectionClosed(); break;
default: break;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!