本文整理汇总了Java中javax.management.MBeanServerNotification.REGISTRATION_NOTIFICATION属性的典型用法代码示例。如果您正苦于以下问题:Java MBeanServerNotification.REGISTRATION_NOTIFICATION属性的具体用法?Java MBeanServerNotification.REGISTRATION_NOTIFICATION怎么用?Java MBeanServerNotification.REGISTRATION_NOTIFICATION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.management.MBeanServerNotification
的用法示例。
在下文中一共展示了MBeanServerNotification.REGISTRATION_NOTIFICATION属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createdNotification
private void createdNotification(MBeanServerNotification n) {
final String shouldEqual =
MBeanServerNotification.REGISTRATION_NOTIFICATION;
if (!n.getType().equals(shouldEqual)) {
logger.warning("createNotification", "bad type: " + n.getType());
return;
}
ObjectName name = n.getMBeanName();
if (logger.debugOn())
logger.debug("createdNotification", "for: " + name);
synchronized (this) {
if (createdDuringQuery != null) {
createdDuringQuery.add(name);
return;
}
}
if (isInstanceOf(mBeanServer, name, broadcasterClass)) {
addBufferListener(name);
if (isDisposed())
removeBufferListener(name);
}
}
示例2: 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();
}
示例3: 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);
}
示例4: 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);
}