本文整理汇总了Java中javax.management.MBeanServerDelegate.DELEGATE_NAME属性的典型用法代码示例。如果您正苦于以下问题:Java MBeanServerDelegate.DELEGATE_NAME属性的具体用法?Java MBeanServerDelegate.DELEGATE_NAME怎么用?Java MBeanServerDelegate.DELEGATE_NAME使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.management.MBeanServerDelegate
的用法示例。
在下文中一共展示了MBeanServerDelegate.DELEGATE_NAME属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendNotification
/**
* Sends an MBeanServerNotifications with the specified type for the
* MBean with the specified ObjectName
*/
private void sendNotification(String NotifType, ObjectName name) {
// ------------------------------
// ------------------------------
// ---------------------
// Create notification
// ---------------------
MBeanServerNotification notif = new MBeanServerNotification(
NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);
if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
MBEANSERVER_LOGGER.logp(Level.FINER,
DefaultMBeanServerInterceptor.class.getName(),
"sendNotification", NotifType + " " + name);
}
delegate.sendNotification(notif);
}
示例2: main
public static void main(String[] args) throws Exception {
System.out.println(
"Test that <MBeanServerDelegate.DELEGATE_NAME> equals " +
"<new ObjectName(\"JMImplementation:type=MBeanServerDelegate\")>");
final ObjectName delegateName =
new ObjectName("JMImplementation:type=MBeanServerDelegate");
if (!delegateName.equals(MBeanServerDelegate.DELEGATE_NAME))
throw new AssertionError("Unexpected value: " +
"MBeanServerDelegate.DELEGATE_NAME = " +
MBeanServerDelegate.DELEGATE_NAME);
System.out.println("MBeanServerDelegate.DELEGATE_NAME = " +
"new ObjectName(\"" + delegateName + "\")");
System.out.println("Test that <ObjectName.WILDCARD> " +
"equals <new ObjectName(\"*:*\")>");
final ObjectName wildcardName = new ObjectName("*:*");
if (!wildcardName.equals(ObjectName.WILDCARD))
throw new AssertionError("Unexpected value: " +
"ObjectName.WILDCARD = " +
ObjectName.WILDCARD);
System.out.println("ObjectName.WILDCARD = " +
"new ObjectName(\"" + wildcardName + "\")");
System.out.println("Test passes: constants were initialized properly");
}
示例3: sendNotification
/**
* Sends an MBeanServerNotifications with the specified type for the
* MBean with the specified ObjectName
*/
private void sendNotification(String NotifType, ObjectName name) {
// ------------------------------
// ------------------------------
// ---------------------
// Create notification
// ---------------------
MBeanServerNotification notif = new MBeanServerNotification(
NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);
if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
MBEANSERVER_LOGGER.log(Level.TRACE, NotifType + " " + name);
}
delegate.sendNotification(notif);
}
示例4: addListenerForMBeanRemovedNotif
protected Integer addListenerForMBeanRemovedNotif()
throws IOException, InstanceNotFoundException {
NotificationFilterSupport clientFilter =
new NotificationFilterSupport();
clientFilter.enableType(
MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
MarshalledObject<NotificationFilter> sFilter =
new MarshalledObject<NotificationFilter>(clientFilter);
Integer[] listenerIDs;
final ObjectName[] names =
new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME};
final MarshalledObject<NotificationFilter>[] filters =
Util.cast(new MarshalledObject<?>[] {sFilter});
final Subject[] subjects = new Subject[] {null};
try {
listenerIDs =
connection.addNotificationListeners(names,
filters,
subjects);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
listenerIDs =
connection.addNotificationListeners(names,
filters,
subjects);
}
return listenerIDs[0];
}
示例5: unregisterMBean
public void unregisterMBean(ObjectName name)
throws InstanceNotFoundException, MBeanRegistrationException {
forbidJMImpl(name);
DynamicMBean mbean = getMBean(name);
if (mbean == null)
throw new InstanceNotFoundException(name.toString());
MBeanRegistration reg = mbeanRegistration(mbean);
try {
reg.preDeregister();
} catch (Exception e) {
throw new MBeanRegistrationException(e);
}
if (!mbeans.remove(name, mbean))
throw new InstanceNotFoundException(name.toString());
// This is incorrect because we've invoked preDeregister
Object userMBean = getUserMBean(mbean);
if (userMBean instanceof ClassLoader)
clr.removeLoader((ClassLoader) userMBean);
Notification n = new MBeanServerNotification(
MBeanServerNotification.REGISTRATION_NOTIFICATION,
MBeanServerDelegate.DELEGATE_NAME,
0,
name);
delegate.sendNotification(n);
reg.postDeregister();
}
示例6: handleNotification
@Override
public void handleNotification(Notification notification) {
String jmxType = notification.getType().equals(RESOURCE_ADDED_NOTIFICATION) ? MBeanServerNotification.REGISTRATION_NOTIFICATION : MBeanServerNotification.UNREGISTRATION_NOTIFICATION;
ObjectName mbeanName = ObjectNameAddressUtil.createObjectName(domain, notification.getSource());
javax.management.Notification jmxNotification = new MBeanServerNotification(jmxType, MBeanServerDelegate.DELEGATE_NAME, sequence.incrementAndGet(), mbeanName);
delegate.sendNotification(jmxNotification);
}
示例7: registerMBean
public ObjectInstance registerMBean(Object object, ObjectName name)
throws InstanceAlreadyExistsException, MBeanRegistrationException,
NotCompliantMBeanException {
forbidJMImpl(name);
if (name.isPattern())
throw new IllegalArgumentException(name.toString());
// This is the only place we check for wildcards. Since you
// can't register a wildcard name, other operations that supply
// one will get InstanceNotFoundException when they look it up.
DynamicMBean mbean;
if (object instanceof DynamicMBean)
mbean = (DynamicMBean) object;
else
mbean = standardToDynamic(object);
MBeanRegistration reg = mbeanRegistration(object);
try {
name = reg.preRegister(this, name);
} catch (Exception e) {
throw new MBeanRegistrationException(e);
}
DynamicMBean put = mbeans.putIfAbsent(name, mbean);
if (put != null) {
reg.postRegister(false);
throw new InstanceAlreadyExistsException(name.toString());
}
reg.postRegister(true);
if (object instanceof ClassLoader)
clr.addLoader((ClassLoader) object);
Notification n = new MBeanServerNotification(
MBeanServerNotification.REGISTRATION_NOTIFICATION,
MBeanServerDelegate.DELEGATE_NAME,
0,
name);
delegate.sendNotification(n);
String className = mbean.getMBeanInfo().getClassName();
return new ObjectInstance(name, className);
}