本文整理匯總了Java中javax.management.MBeanNotificationInfo類的典型用法代碼示例。如果您正苦於以下問題:Java MBeanNotificationInfo類的具體用法?Java MBeanNotificationInfo怎麽用?Java MBeanNotificationInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MBeanNotificationInfo類屬於javax.management包,在下文中一共展示了MBeanNotificationInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getMBeanInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
@Override
public MBeanInfo getMBeanInfo() {
ArrayList<OpenMBeanAttributeInfoSupport> attributes = new ArrayList<>();
attributes.add(new OpenMBeanAttributeInfoSupport("enabled", "enabled", SimpleType.BOOLEAN, true, true, true));
for (String type : registry.getTypes()) {
attributes.add(new OpenMBeanAttributeInfoSupport(type, type, getCompositeType(type), true, false, false));
}
OpenMBeanParameterInfo[] params = new OpenMBeanParameterInfoSupport[0];
OpenMBeanOperationInfoSupport reset = new OpenMBeanOperationInfoSupport("reset", "Reset all Metrics", params,
SimpleType.VOID, MBeanOperationInfo.ACTION);
OpenMBeanInfoSupport PSOMBInfo = new OpenMBeanInfoSupport(this.getClass().getName(), description,
attributes.toArray(new OpenMBeanAttributeInfoSupport[0]), new OpenMBeanConstructorInfoSupport[0],
new OpenMBeanOperationInfoSupport[] { reset }, new MBeanNotificationInfo[0]);
return PSOMBInfo;
}
示例2: getNotificationInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
// FIXME: i18n
if (notificationInfo == null) {
notificationInfo = new MBeanNotificationInfo[] {
new MBeanNotificationInfo(new String[] { "j2ee.object.created" }, Notification.class.getName(),
"web application is created"),
new MBeanNotificationInfo(new String[] { "j2ee.state.starting" }, Notification.class.getName(),
"change web application is starting"),
new MBeanNotificationInfo(new String[] { "j2ee.state.running" }, Notification.class.getName(),
"web application is running"),
new MBeanNotificationInfo(new String[] { "j2ee.state.stopping" }, Notification.class.getName(),
"web application start to stopped"),
new MBeanNotificationInfo(new String[] { "j2ee.object.stopped" }, Notification.class.getName(),
"web application is stopped"),
new MBeanNotificationInfo(new String[] { "j2ee.object.deleted" }, Notification.class.getName(),
"web application is deleted") };
}
return notificationInfo;
}
示例3: getMBeanInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
/**
* Return the MBeanInfo for the given resource, based on the given
* per-interface data.
*/
final MBeanInfo getMBeanInfo(Object resource, PerInterface<M> perInterface) {
MBeanInfo mbi =
getClassMBeanInfo(resource.getClass(), perInterface);
MBeanNotificationInfo[] notifs = findNotifications(resource);
if (notifs == null || notifs.length == 0)
return mbi;
else {
return new MBeanInfo(mbi.getClassName(),
mbi.getDescription(),
mbi.getAttributes(),
mbi.getConstructors(),
mbi.getOperations(),
notifs,
mbi.getDescriptor());
}
}
示例4: getNotificationInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
/**
* 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();
}
示例5: getNotificationInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
/**
* Returns a NotificationInfo object containing the name of the Java class
* of the notification and the notification types sent.
*/
public MBeanNotificationInfo[] getNotificationInfo() {
RELATION_LOGGER.entering(RelationService.class.getName(),
"getNotificationInfo");
String ntfClass = "javax.management.relation.RelationNotification";
String[] ntfTypes = new String[] {
RelationNotification.RELATION_BASIC_CREATION,
RelationNotification.RELATION_MBEAN_CREATION,
RelationNotification.RELATION_BASIC_UPDATE,
RelationNotification.RELATION_MBEAN_UPDATE,
RelationNotification.RELATION_BASIC_REMOVAL,
RelationNotification.RELATION_MBEAN_REMOVAL,
};
String ntfDesc = "Sent when a relation is created, updated or deleted.";
MBeanNotificationInfo ntfInfo =
new MBeanNotificationInfo(ntfTypes, ntfClass, ntfDesc);
RELATION_LOGGER.exiting(RelationService.class.getName(),
"getNotificationInfo");
return new MBeanNotificationInfo[] {ntfInfo};
}
示例6: getNotificationInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
if (notificationInfo == null) {
notificationInfo = new MBeanNotificationInfo[] {
new MBeanNotificationInfo(new String[] { "j2ee.object.created" }, Notification.class.getName(),
"servlet is created"),
new MBeanNotificationInfo(new String[] { "j2ee.state.starting" }, Notification.class.getName(),
"servlet is starting"),
new MBeanNotificationInfo(new String[] { "j2ee.state.running" }, Notification.class.getName(),
"servlet is running"),
new MBeanNotificationInfo(new String[] { "j2ee.state.stopped" }, Notification.class.getName(),
"servlet start to stopped"),
new MBeanNotificationInfo(new String[] { "j2ee.object.stopped" }, Notification.class.getName(),
"servlet is stopped"),
new MBeanNotificationInfo(new String[] { "j2ee.object.deleted" }, Notification.class.getName(),
"servlet is deleted") };
}
return notificationInfo;
}
示例7: main
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
public static void main(String[] args) throws Exception {
// Instantiate the MBean server
//
final MBeanAttributeInfo[] atts = makeAttInfos(attributes);
final MBeanConstructorInfo[] ctors = makeCtorInfos(constructors);
final MBeanOperationInfo[] ops = makeOpInfos(operations);
final MBeanNotificationInfo[] notifs =
makeNotifInfos(notificationclasses);
for (int i=0; i<mbeanclasses.length;i++) {
System.out.println("Create an MBeanInfo: " + mbeanclasses[i][0]);
final MBeanInfo mbi =
new MBeanInfo(mbeanclasses[i][1],mbeanclasses[i][0],
atts, ctors, ops, notifs);
}
// Test OK!
//
System.out.println("All MBeanInfo successfuly created!");
System.out.println("Bye! Bye!");
}
示例8: getNotificationInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
/**
* This MBean emits three kind of notifications:
* <pre>
* <i>com.sun.jmx.examples.scandir.log.file.switched</i>
* <i>com.sun.jmx.examples.scandir.log.memory.full</i>
* <i>com.sun.jmx.examples.scandir.log.memory.cleared</i>
* </pre>
**/
public MBeanNotificationInfo[] getNotificationInfo() {
return new MBeanNotificationInfo[] {
new MBeanNotificationInfo(new String[] {
LOG_FILE_CHANGED},
Notification.class.getName(),
"Emitted when the log file is switched")
,
new MBeanNotificationInfo(new String[] {
MEMORY_LOG_MAX_CAPACITY},
Notification.class.getName(),
"Emitted when the memory log capacity is reached")
,
new MBeanNotificationInfo(new String[] {
MEMORY_LOG_CLEARED},
Notification.class.getName(),
"Emitted when the memory log is cleared")
};
}
示例9: getNotificationInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
public MBeanNotificationInfo[] getNotificationInfo() {
if (notifDescriptorAtt == null) {
initNotifDescriptorAtt();
}
return new MBeanNotificationInfo[]{
new MBeanNotificationInfo(new String[]{
NOTIF_TYPE_0
},
javax.management.Notification.class.getName(),
"Standard JMX Notification",
notifDescriptorAtt),
new MBeanNotificationInfo(new String[]{
NOTIF_TYPE_1
},
SqeNotification.class.getName(),
"SQE Notification",
notifDescriptorAtt)
};
}
示例10: printMBeanInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
private void printMBeanInfo(MBeanInfo mbInfo) {
System.out.println("Description " + mbInfo.getDescription());
for (MBeanConstructorInfo ctor : mbInfo.getConstructors()) {
System.out.println("Constructor " + ctor.getName());
}
for (MBeanAttributeInfo att : mbInfo.getAttributes()) {
System.out.println("Attribute " + att.getName()
+ " [" + att.getType() + "]");
}
for (MBeanOperationInfo oper : mbInfo.getOperations()) {
System.out.println("Operation " + oper.getName());
}
for (MBeanNotificationInfo notif : mbInfo.getNotifications()) {
System.out.println("Notification " + notif.getName());
}
}
示例11: checkMBeanInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
private int checkMBeanInfo(MBeanInfo mbi, Descriptor refDescr) {
MBeanNotificationInfo[] notifsInfo = mbi.getNotifications();
int res = 0;
for (MBeanNotificationInfo mbni : notifsInfo) {
if ( mbni.getDescriptor().equals(refDescr) ) {
System.out.println("(OK)");
} else {
System.out.println("(ERROR) Descriptor of the notification is "
+ mbni.getDescriptor()
+ " as we expect "
+ refDescr);
res++;
}
}
return res;
}
示例12: getNotificationInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
/**
* Returns a NotificationInfo object containing the name of the Java class
* of the notification and the notification types sent.
*/
public MBeanNotificationInfo[] getNotificationInfo() {
RELATION_LOGGER.log(Level.TRACE, "ENTRY");
String ntfClass = "javax.management.relation.RelationNotification";
String[] ntfTypes = new String[] {
RelationNotification.RELATION_BASIC_CREATION,
RelationNotification.RELATION_MBEAN_CREATION,
RelationNotification.RELATION_BASIC_UPDATE,
RelationNotification.RELATION_MBEAN_UPDATE,
RelationNotification.RELATION_BASIC_REMOVAL,
RelationNotification.RELATION_MBEAN_REMOVAL,
};
String ntfDesc = "Sent when a relation is created, updated or deleted.";
MBeanNotificationInfo ntfInfo =
new MBeanNotificationInfo(ntfTypes, ntfClass, ntfDesc);
RELATION_LOGGER.log(Level.TRACE, "RETURN");
return new MBeanNotificationInfo[] {ntfInfo};
}
示例13: getNotificationInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
MBeanNotificationInfo[] pres = super.getNotificationInfo();
MBeanNotificationInfo[] loc = getDefaultNotificationInfo();
MBeanNotificationInfo[] aug = new MBeanNotificationInfo[pres.length + loc.length];
if (pres.length>0) System.arraycopy(pres, 0, aug, 0, pres.length);
if (loc.length >0) System.arraycopy(loc, 0, aug, pres.length, loc.length);
return aug;
}
示例14: getDefaultNotificationInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
public static MBeanNotificationInfo[] getDefaultNotificationInfo() {
String[] types = new String[] {NOTIFY_INIT, NOTIFY_CONNECT, NOTIFY_ABANDON, SLOW_QUERY_NOTIFICATION,
FAILED_QUERY_NOTIFICATION, SUSPECT_ABANDONED_NOTIFICATION, POOL_EMPTY, SUSPECT_RETURNED_NOTIFICATION};
String name = Notification.class.getName();
String description = "A connection pool error condition was met.";
MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description);
return new MBeanNotificationInfo[] {info};
}
示例15: getNotificationInfo
import javax.management.MBeanNotificationInfo; //導入依賴的package包/類
public MBeanNotificationInfo[] getNotificationInfo() {
// FIXME: i18n
if(notificationInfo == null) {
notificationInfo = new MBeanNotificationInfo[]{
new MBeanNotificationInfo(new String[] {
"j2ee.object.created"},
Notification.class.getName(),
"web application is created"
),
new MBeanNotificationInfo(new String[] {
"j2ee.state.starting"},
Notification.class.getName(),
"change web application is starting"
),
new MBeanNotificationInfo(new String[] {
"j2ee.state.running"},
Notification.class.getName(),
"web application is running"
),
new MBeanNotificationInfo(new String[] {
"j2ee.state.stopped"},
Notification.class.getName(),
"web application start to stopped"
),
new MBeanNotificationInfo(new String[] {
"j2ee.object.stopped"},
Notification.class.getName(),
"web application is stopped"
),
new MBeanNotificationInfo(new String[] {
"j2ee.object.deleted"},
Notification.class.getName(),
"web application is deleted"
)
};
}
return notificationInfo;
}