本文整理汇总了Java中javax.management.NotificationBroadcaster.removeNotificationListener方法的典型用法代码示例。如果您正苦于以下问题:Java NotificationBroadcaster.removeNotificationListener方法的具体用法?Java NotificationBroadcaster.removeNotificationListener怎么用?Java NotificationBroadcaster.removeNotificationListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.NotificationBroadcaster
的用法示例。
在下文中一共展示了NotificationBroadcaster.removeNotificationListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeNotificationListener
import javax.management.NotificationBroadcaster; //导入方法依赖的package包/类
public void removeNotificationListener(
ObjectName name, NotificationListener listener)
throws InstanceNotFoundException, ListenerNotFoundException {
NotificationBroadcaster userMBean =
(NotificationBroadcaster) getUserMBean(name);
NotificationListener wrappedListener =
wrappedListener(name, userMBean, listener);
userMBean.removeNotificationListener(wrappedListener);
}
示例2: removeNotificationListener
import javax.management.NotificationBroadcaster; //导入方法依赖的package包/类
private void removeNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback,
boolean removeAll)
throws InstanceNotFoundException, ListenerNotFoundException {
if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name);
}
DynamicMBean instance = getMBean(name);
checkMBeanPermission(instance, null, name, "removeNotificationListener");
/* We could simplify the code by assigning broadcaster after
assigning listenerWrapper, but that would change the error
behavior when both the broadcaster and the listener are
erroneous. */
Class<? extends NotificationBroadcaster> reqClass =
removeAll ? NotificationBroadcaster.class : NotificationEmitter.class;
NotificationBroadcaster broadcaster =
getNotificationBroadcaster(name, instance, reqClass);
NotificationListener listenerWrapper =
getListenerWrapper(listener, name, instance, false);
if (listenerWrapper == null)
throw new ListenerNotFoundException("Unknown listener");
if (removeAll)
broadcaster.removeNotificationListener(listenerWrapper);
else {
NotificationEmitter emitter = (NotificationEmitter) broadcaster;
emitter.removeNotificationListener(listenerWrapper,
filter,
handback);
}
}
示例3: removeNotificationListener
import javax.management.NotificationBroadcaster; //导入方法依赖的package包/类
private void removeNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback,
boolean removeAll)
throws InstanceNotFoundException, ListenerNotFoundException {
if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
MBEANSERVER_LOGGER.logp(Level.FINER,
DefaultMBeanServerInterceptor.class.getName(),
"removeNotificationListener", "ObjectName = " + name);
}
DynamicMBean instance = getMBean(name);
checkMBeanPermission(instance, null, name, "removeNotificationListener");
/* We could simplify the code by assigning broadcaster after
assigning listenerWrapper, but that would change the error
behavior when both the broadcaster and the listener are
erroneous. */
Class<? extends NotificationBroadcaster> reqClass =
removeAll ? NotificationBroadcaster.class : NotificationEmitter.class;
NotificationBroadcaster broadcaster =
getNotificationBroadcaster(name, instance, reqClass);
NotificationListener listenerWrapper =
getListenerWrapper(listener, name, instance, false);
if (listenerWrapper == null)
throw new ListenerNotFoundException("Unknown listener");
if (removeAll)
broadcaster.removeNotificationListener(listenerWrapper);
else {
NotificationEmitter emitter = (NotificationEmitter) broadcaster;
emitter.removeNotificationListener(listenerWrapper,
filter,
handback);
}
}
示例4: removeNotificationListener
import javax.management.NotificationBroadcaster; //导入方法依赖的package包/类
/**
* Removes the specified listener from the list of recipients
* of notifications from the supplied bean. This includes all
* combinations of filters and passback objects registered for
* this listener. For more specific removal of listeners, see
* {@link #removeNotificationListener(ObjectName,
* NotificationListener,NotificationFilter,Object)}
*
* @param name the name of the management bean from which the
* listener should be removed.
* @param listener the listener to remove.
* @throws InstanceNotFoundException if the bean can not be found.
* @throws ListenerNotFoundException if the specified listener
* is not registered with the bean.
* @throws SecurityException if a security manager exists and the
* caller's permissions don't imply {@link
* MBeanPermission(String,String,ObjectName,String)
* <code>MBeanPermission(className, null, name,
* "removeNotificationListener")</code>}.
* @see #addNotificationListener(NotificationListener, NotificationFilter,
* java.lang.Object)
* @see NotificationBroadcaster#removeNotificationListener(NotificationListener)
*/
public void removeNotificationListener(ObjectName name,
NotificationListener listener)
throws InstanceNotFoundException, ListenerNotFoundException
{
Object bean = getBean(name);
checkSecurity(name, null, "removeNotificationListener");
if (bean instanceof NotificationBroadcaster)
{
NotificationBroadcaster bbean = (NotificationBroadcaster) bean;
bbean.removeNotificationListener(listener);
LazyListenersHolder.listeners.remove(listener);
}
}
示例5: removeNotificationListener
import javax.management.NotificationBroadcaster; //导入方法依赖的package包/类
/**
* Removes the specified listener from the list of recipients
* of notifications from the supplied bean. This includes all
* combinations of filters and passback objects registered for
* this listener. For more specific removal of listeners, see
* {@link #removeNotificationListener(ObjectName,
* NotificationListener,NotificationFilter,Object)}
*
* @param name the name of the management bean from which the
* listener should be removed.
* @param listener the listener to remove.
* @throws InstanceNotFoundException if the bean can not be found.
* @throws ListenerNotFoundException if the specified listener
* is not registered with the bean.
* @throws SecurityException if a security manager exists and the
* caller's permissions don't imply {@link
* MBeanPermission(String,String,ObjectName,String)
* <code>MBeanPermission(className, null, name,
* "removeNotificationListener")</code>}.
* @see #addNotificationListener(NotificationListener, NotificationFilter,
* java.lang.Object)
* @see NotificationBroadcaster#removeNotificationListener(NotificationListener)
*/
public void removeNotificationListener(ObjectName name,
NotificationListener listener)
throws InstanceNotFoundException, ListenerNotFoundException
{
Object bean = getBean(name);
checkSecurity(name, null, "removeNotificationListener");
if (bean instanceof NotificationBroadcaster)
{
NotificationBroadcaster bbean = (NotificationBroadcaster) bean;
bbean.removeNotificationListener(listener);
LazyListenersHolder.listeners.remove(listener);
}
}