本文整理了Java中javax.management.AttributeChangeNotification.getAttributeName()
方法的一些代码示例,展示了AttributeChangeNotification.getAttributeName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AttributeChangeNotification.getAttributeName()
方法的具体详情如下:
包路径:javax.management.AttributeChangeNotification
类名称:AttributeChangeNotification
方法名:getAttributeName
暂无
代码示例来源:origin: spring-projects/spring-framework
@Override
public boolean isNotificationEnabled(Notification notification) {
if (notification instanceof AttributeChangeNotification) {
AttributeChangeNotification changeNotification = (AttributeChangeNotification) notification;
return "Name".equals(changeNotification.getAttributeName());
}
else {
return false;
}
}
});
代码示例来源:origin: spring-projects/spring-framework
@Override
public void handleNotification(Notification notification, Object handback) {
if (notification instanceof AttributeChangeNotification) {
AttributeChangeNotification attNotification = (AttributeChangeNotification) notification;
String attributeName = attNotification.getAttributeName();
Integer currentCount = (Integer) this.attributeCounts.get(attributeName);
if (currentCount != null) {
int count = currentCount.intValue() + 1;
this.attributeCounts.put(attributeName, new Integer(count));
}
else {
this.attributeCounts.put(attributeName, new Integer(1));
}
this.attributeHandbacks.put(attributeName, handback);
}
}
代码示例来源: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
@Override
public boolean isNotificationEnabled(Notification notification) {
// 直关心 AttributeChangeNotification 通知,并且仅限于字段/属性名称为 "data"
if (AttributeChangeNotification.class.isAssignableFrom(notification.getClass())) {
AttributeChangeNotification attributeChangeNotification = AttributeChangeNotification.class.cast(notification);
if ("data".equals(attributeChangeNotification.getAttributeName())) {
return true;
}
}
return false;
}
代码示例来源:origin: jboss.web/jbossweb
/**
* <p>Test whether notification enabled for this event.
* Return true if:</p>
* <ul>
* <li>This is an attribute change notification</li>
* <li>Either the set of accepted names is empty (implying that all
* attribute names are of interest) or the set of accepted names
* includes the name of the attribute in this notification</li>
* </ul>
*/
public boolean isNotificationEnabled(Notification notification) {
if (notification == null)
return (false);
if (!(notification instanceof AttributeChangeNotification))
return (false);
AttributeChangeNotification acn =
(AttributeChangeNotification) notification;
if (!AttributeChangeNotification.ATTRIBUTE_CHANGE.equals(acn.getType()))
return (false);
synchronized (names) {
if (names.size() < 1)
return (true);
else
return (names.contains(acn.getAttributeName()));
}
}
代码示例来源:origin: commons-modeler/commons-modeler
/**
* <p>Test whether notification enabled for this event.
* Return true if:</p>
* <ul>
* <li>This is an attribute change notification</li>
* <li>Either the set of accepted names is empty (implying that all
* attribute names are of interest) or the set of accepted names
* includes the name of the attribute in this notification</li>
* </ul>
*/
public boolean isNotificationEnabled(Notification notification) {
if (notification == null)
return (false);
if (!(notification instanceof AttributeChangeNotification))
return (false);
AttributeChangeNotification acn =
(AttributeChangeNotification) notification;
if (!AttributeChangeNotification.ATTRIBUTE_CHANGE.equals(acn.getType()))
return (false);
synchronized (names) {
if (names.size() < 1)
return (true);
else
return (names.contains(acn.getAttributeName()));
}
}
代码示例来源:origin: org.jboss.web/jbossweb
/**
* <p>Test whether notification enabled for this event.
* Return true if:</p>
* <ul>
* <li>This is an attribute change notification</li>
* <li>Either the set of accepted names is empty (implying that all
* attribute names are of interest) or the set of accepted names
* includes the name of the attribute in this notification</li>
* </ul>
*/
public boolean isNotificationEnabled(Notification notification) {
if (notification == null)
return (false);
if (!(notification instanceof AttributeChangeNotification))
return (false);
AttributeChangeNotification acn =
(AttributeChangeNotification) notification;
if (!AttributeChangeNotification.ATTRIBUTE_CHANGE.equals(acn.getType()))
return (false);
synchronized (names) {
if (names.size() < 1)
return (true);
else
return (names.contains(acn.getAttributeName()));
}
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* <p>Test whether notification enabled for this event.
* Return true if:</p>
* <ul>
* <li>This is an attribute change notification</li>
* <li>Either the set of accepted names is empty (implying that all
* attribute names are of interest) or the set of accepted names
* includes the name of the attribute in this notification</li>
* </ul>
*/
@Override
public boolean isNotificationEnabled(Notification notification) {
if (notification == null)
return (false);
if (!(notification instanceof AttributeChangeNotification))
return (false);
AttributeChangeNotification acn =
(AttributeChangeNotification) notification;
if (!AttributeChangeNotification.ATTRIBUTE_CHANGE.equals(acn.getType()))
return (false);
synchronized (names) {
if (names.size() < 1)
return (true);
else
return (names.contains(acn.getAttributeName()));
}
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/util
/**
* <p>Test whether notification enabled for this event.
* Return true if:</p>
* <ul>
* <li>This is an attribute change notification</li>
* <li>Either the set of accepted names is empty (implying that all
* attribute names are of interest) or the set of accepted names
* includes the name of the attribute in this notification</li>
* </ul>
*/
@Override
public boolean isNotificationEnabled(Notification notification) {
if (notification == null)
return (false);
if (!(notification instanceof AttributeChangeNotification))
return (false);
AttributeChangeNotification acn =
(AttributeChangeNotification) notification;
if (!AttributeChangeNotification.ATTRIBUTE_CHANGE.equals(acn.getType()))
return (false);
synchronized (names) {
if (names.size() < 1)
return (true);
else
return (names.contains(acn.getAttributeName()));
}
}
代码示例来源: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.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: org.eclipse.persistence/org.eclipse.persistence.sdo
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: wildfly/wildfly-core
@Override
public void handleNotification(Notification notification, Object handback) {
AttributeChangeNotification attributeChangeNotification = (AttributeChangeNotification) notification;
if ("RuntimeConfigurationState".equals(attributeChangeNotification.getAttributeName())) {
writeNotification(attributeChangeNotification, getRuntimeConfigurationTargetFile());
} else {
writeNotification(attributeChangeNotification, getRunningConfigurationTargetFile());
}
}
代码示例来源: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());
}
内容来源于网络,如有侵权,请联系作者删除!