当前位置: 首页>>代码示例>>Java>>正文


Java NotificationBroadcaster.removeNotificationListener方法代码示例

本文整理汇总了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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:OldMBeanServerTest.java

示例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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:DefaultMBeanServerInterceptor.java

示例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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:DefaultMBeanServerInterceptor.java

示例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);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:37,代码来源:Server.java

示例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);
     }
 }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:37,代码来源:Server.java


注:本文中的javax.management.NotificationBroadcaster.removeNotificationListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。