本文整理匯總了Java中javax.management.AttributeChangeNotification.ATTRIBUTE_CHANGE屬性的典型用法代碼示例。如果您正苦於以下問題:Java AttributeChangeNotification.ATTRIBUTE_CHANGE屬性的具體用法?Java AttributeChangeNotification.ATTRIBUTE_CHANGE怎麽用?Java AttributeChangeNotification.ATTRIBUTE_CHANGE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.management.AttributeChangeNotification
的用法示例。
在下文中一共展示了AttributeChangeNotification.ATTRIBUTE_CHANGE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getNotificationInfo
/**
* Returns an array of MBeanNotificationInfo objects describing
* the notification types sent by this CommunicatorServer.
* There is only one type of notifications sent by the CommunicatorServer:
* it is <tt>{@link javax.management.AttributeChangeNotification}</tt>,
* sent when the <tt>State</tt> attribute of this CommunicatorServer
* changes.
*/
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
// Initialize notifInfos on first call to getNotificationInfo()
//
if (notifInfos == null) {
notifInfos = new MBeanNotificationInfo[1];
String[] notifTypes = {
AttributeChangeNotification.ATTRIBUTE_CHANGE};
notifInfos[0] = new MBeanNotificationInfo( notifTypes,
AttributeChangeNotification.class.getName(),
"Sent to notify that the value of the State attribute "+
"of this CommunicatorServer instance has changed.");
}
return notifInfos.clone();
}
示例2: getNotificationInfo
/**
* Returns an array of MBeanNotificationInfo objects describing
* the notification types sent by this CommunicatorServer.
* There is only one type of notifications sent by the CommunicatorServer:
* it is <tt>{@link javax.management.AttributeChangeNotification}</tt>,
* sent when the <tt>State</tt> attribute of this CommunicatorServer
* changes.
*/
public MBeanNotificationInfo[] getNotificationInfo() {
// Initialize notifInfos on first call to getNotificationInfo()
//
if (notifInfos == null) {
notifInfos = new MBeanNotificationInfo[1];
String[] notifTypes = {
AttributeChangeNotification.ATTRIBUTE_CHANGE};
notifInfos[0] = new MBeanNotificationInfo( notifTypes,
AttributeChangeNotification.class.getName(),
"Sent to notify that the value of the State attribute "+
"of this CommunicatorServer instance has changed.");
}
return notifInfos;
}
示例3: getNotifications
private MBeanNotificationInfo[] getNotifications() {
List<MBeanNotificationInfo> notifications = new ArrayList<>();
for (Map.Entry<String, NotificationEntry> entry : resourceRegistration.getNotificationDescriptions(PathAddress.EMPTY_ADDRESS, true).entrySet()) {
ModelNode descriptionModel = entry.getValue().getDescriptionProvider().getModelDescription(null);
String description = descriptionModel.get(DESCRIPTION).asString();
String notificationType = entry.getKey();
MBeanNotificationInfo info = null;
if (notificationType.equals(ModelDescriptionConstants.ATTRIBUTE_VALUE_WRITTEN_NOTIFICATION)) {
info = new MBeanNotificationInfo(new String[]{AttributeChangeNotification.ATTRIBUTE_CHANGE}, AttributeChangeNotification.class.getName(), description);
} else if (notificationType.equals(ModelDescriptionConstants.RESOURCE_ADDED_NOTIFICATION)
|| notificationType.equals(ModelDescriptionConstants.RESOURCE_REMOVED_NOTIFICATION)) {
// do not expose these notifications as they are emitted by the JMImplementation:type=MBeanServerDelegate MBean.
} else {
info = new MBeanNotificationInfo(new String[]{notificationType}, Notification.class.getName(), description);
}
if (info != null) {
notifications.add(info);
}
}
return notifications.toArray(new MBeanNotificationInfo[notifications.size()]);
}
示例4: getNotificationInfo
/**
* The {@link DirectoryScannerMXBean} may send two types of
* notifications: filematch, and state attribute changed.
**/
public MBeanNotificationInfo[] getNotificationInfo() {
return new MBeanNotificationInfo[] {
new MBeanNotificationInfo(
new String[] {FILE_MATCHES_NOTIFICATION},
Notification.class.getName(),
"Emitted when a file that matches the scan criteria is found"
),
new MBeanNotificationInfo(
new String[] {AttributeChangeNotification.ATTRIBUTE_CHANGE},
AttributeChangeNotification.class.getName(),
"Emitted when the State attribute changes"
)
};
}
示例5: getNotificationInfo
/**
* We emit an {@code AttributeChangeNotification} when the {@code State}
* attribute changes.
**/
public MBeanNotificationInfo[] getNotificationInfo() {
return new MBeanNotificationInfo[] {
new MBeanNotificationInfo(new String[] {
AttributeChangeNotification.ATTRIBUTE_CHANGE},
AttributeChangeNotification.class.getName(),
"Emitted when the State attribute changes")
};
}
示例6: getNotificationInfo
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
String[] ntfTypes = new String[]{AttributeChangeNotification.ATTRIBUTE_CHANGE};
String ntfClassName = AttributeChangeNotification.class.getName();
String ntfDescription = "A COJAC event occured !";
MBeanNotificationInfo ntfInfo = new MBeanNotificationInfo(ntfTypes, ntfClassName, ntfDescription);
return new MBeanNotificationInfo[]{ntfInfo};
}
示例7: getNotificationInfo
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
Log.i("getNotificationInfo");
String[] types = new String[] {AttributeChangeNotification.ATTRIBUTE_CHANGE};
String name = AttributeChangeNotification.class.getName();
String description = "An attribute of this MBean has changed";
MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description);
return new MBeanNotificationInfo[] {info};
}
示例8: getNotificationInfo
@Override
public MBeanNotificationInfo[] getNotificationInfo()
{// from http://download.oracle.com/javase/1.5.0/docs/guide/jmx/tutorial/essential.html#wp1053200
String[] types = new String[] {
AttributeChangeNotification.ATTRIBUTE_CHANGE
};
String name = AttributeChangeNotification.class.getName();
String description = "An update to status was received";
MBeanNotificationInfo info =
new MBeanNotificationInfo(types, name, description);
return new MBeanNotificationInfo[] {info};
}
示例9: getNotificationInfo
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
String[] types = new String[]{
AttributeChangeNotification.ATTRIBUTE_CHANGE
};
String name = AttributeChangeNotification.class.getName();
String description = "An attribute of this MBean has changed";
MBeanNotificationInfo info =
new MBeanNotificationInfo(types, name, description);
return new MBeanNotificationInfo[]{info};
}
示例10: getNotificationInfo
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
String[] types = new String[] {
AttributeChangeNotification.ATTRIBUTE_CHANGE
};
String name = AttributeChangeNotification.class.getName();
String description = "An attribute of this MBean has changed";
MBeanNotificationInfo info =
new MBeanNotificationInfo(types, name, description);
return new MBeanNotificationInfo[] {info};
}
示例11: getNotificationInfo
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
String[] types = new String[]{
AttributeChangeNotification.ATTRIBUTE_CHANGE
};
String name = "notification on faliure";
String description = "An instance has failed";
MBeanNotificationInfo info =
new MBeanNotificationInfo(types, name, description);
return new MBeanNotificationInfo[]{info};
}
示例12: getNotificationInfo
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
return new MBeanNotificationInfo[]{
new MBeanNotificationInfo(
new String[]{AttributeChangeNotification.ATTRIBUTE_CHANGE},
AttributeChangeNotification.class.getName(),
ServerLogger.ROOT_LOGGER.processStateChangeNotificationDescription())};
}
示例13: getNotificationInfo
/**
* Notification info.
*/
public MBeanNotificationInfo[] getNotificationInfo() {
MBeanNotificationInfo info1 = new MBeanNotificationInfo(
new String[] { AttributeChangeNotification.ATTRIBUTE_CHANGE },
AttributeChangeNotification.class.getName(),
"Attribute change notification");
MBeanNotificationInfo info2 = new MBeanNotificationInfo(
new String[] { SAY_HELLO_INVOKED }, Notification.class.getName(),
"sayHello() invoked notification");
return new MBeanNotificationInfo[] { info1, info2 };
}
示例14: init
/**
* Construct MBeanInfo object.
*
* @throws NoSuchMethodException
* @throws SecurityException
* @throws IntrospectionException
*/
public void init() throws Exception {
final Class c = Hello.class;
attributes = new MBeanAttributeInfo[] {
new MBeanAttributeInfo("attribute1", "attribute1 desc", c
.getMethod("getAttribute1", new Class[0]), c.getMethod(
"setAttribute1", new Class[] { String.class })),
new MBeanAttributeInfo("attribute4", "attribute4 desc", c
.getMethod("isAttribute4", new Class[0]), null) };
constructors = new MBeanConstructorInfo[] {
new MBeanConstructorInfo("constructor1", c
.getConstructor(new Class[0])),
new MBeanConstructorInfo("constructor2", c
.getConstructor(new Class[] { String.class, String.class,
String.class, boolean.class, Object.class })) };
operations = new MBeanOperationInfo[] {
new MBeanOperationInfo("sayHello", c.getMethod("sayHello",
new Class[0])),
new MBeanOperationInfo("sayHello", c.getMethod("operation",
new Class[] { Object.class })) };
notifications = new MBeanNotificationInfo[] {
new MBeanNotificationInfo(
new String[] { AttributeChangeNotification.ATTRIBUTE_CHANGE },
AttributeChangeNotification.class.getName(), "desc"),
new MBeanNotificationInfo(new String[] { Hello.SAY_HELLO_INVOKED },
Hello.class.getName(), "sayHello desc") };
inf = new MBeanInfo(Hello.class.getName(), "HelloMBean description",
attributes, constructors, operations, notifications);
inf2 = new MBeanInfo(Hello.class.getName(), null, null, null, null,
null);
}
示例15: handleNotification
public void handleNotification(Notification notification, Object handback) {
try {
String notificationType = notification.getType();
LOGGER.trace("Streams Instance Notification: " + notification
+ "; User Data: " + notification.getUserData());
switch (notificationType) {
case AttributeChangeNotification.ATTRIBUTE_CHANGE:
AttributeChangeNotification acn = (AttributeChangeNotification) notification;
String attributeName = acn.getAttributeName();
if (attributeName.equals("Status")) {
InstanceMXBean.Status newValue = (InstanceMXBean.Status) acn
.getNewValue();
InstanceMXBean.Status oldValue = (InstanceMXBean.Status) acn
.getOldValue();
LOGGER.info("Streams Instance Status Changed from: " + oldValue
+ " to: " + newValue);
this.instanceInfo.setInstanceStatus((InstanceMXBean.Status) acn
.getNewValue());
if (newValue.equals(InstanceMXBean.Status.STOPPED)
|| newValue.equals(InstanceMXBean.Status.FAILED)
|| newValue.equals(InstanceMXBean.Status.UNKNOWN)) {
LOGGER.info("Instance Status reflects not availabe status ("
+ newValue
+ "), monitor will reset and reinitialize when instance is available");
this.instanceInfo.setInstanceStartTime(null);
resetTracker();
clearTracker();
metricsExporter.getStreamsMetric("status", StreamsObjectType.INSTANCE, this.domainName, this.instanceInfo.getInstanceName()).set(getInstanceStatusAsMetric());
}
}
break;
case Notifications.INSTANCE_DELETED:
LOGGER.debug("Instance deleted from domain, resetting monitor and waiting for instance to be recreated");
this.instanceInfo.setInstanceExists(false);
resetTracker();
clearTracker();
break;
case Notifications.JOB_ADDED:
LOGGER.debug("****** Job add notification, Jobid : "
+ notification.getUserData());
addJobToMap((BigInteger) notification.getUserData());
break;
case Notifications.JOB_REMOVED:
LOGGER.debug("******** Job removed notification, userData: "
+ notification.getUserData());
// We are only listening on Straems Instance, so user data is a
// jobid
removeJobFromMap((BigInteger) notification.getUserData());
break;
}
} catch (Exception e) {
LOGGER.error("Instance Notification Handler caught exception: {}",e.toString());
e.printStackTrace();
}
}