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


Java NotificationEmitter.removeNotificationListener方法代码示例

本文整理汇总了Java中javax.management.NotificationEmitter.removeNotificationListener方法的典型用法代码示例。如果您正苦于以下问题:Java NotificationEmitter.removeNotificationListener方法的具体用法?Java NotificationEmitter.removeNotificationListener怎么用?Java NotificationEmitter.removeNotificationListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.management.NotificationEmitter的用法示例。


在下文中一共展示了NotificationEmitter.removeNotificationListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exitImpl

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
private synchronized void exitImpl(int exitCode) {
    if (exitHandler != null) {
        try {
            exitHandler.invoke(null, exitCode);
        } catch (Throwable ignored) {
        }
    }
    disabled = true;
    if (timer != null) {
        timer.cancel();
    }

    if (memoryListener != null && memoryMBean != null) {
        NotificationEmitter emitter = (NotificationEmitter) memoryMBean;
        try {
            emitter.removeNotificationListener(memoryListener);
        } catch (ListenerNotFoundException lnfe) {}
    }

    if (threadPool != null) {
        threadPool.shutdownNow();
    }

    send(new ExitCommand(exitCode));
}
 
开发者ID:haitaoyao,项目名称:btrace,代码行数:26,代码来源:BTraceRuntime.java

示例2: stopMonitoring

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
/**
 * Stops all three mechanisms from monitoring heap usage.
 */
@Override
public void stopMonitoring() {
  synchronized (this) {
    if (!this.started) {
      return;
    }

    // Stop the poller
    this.resourceManager.stopExecutor(this.pollerExecutor);

    // Stop the JVM threshold listener
    NotificationEmitter emitter = (NotificationEmitter) ManagementFactory.getMemoryMXBean();
    try {
      emitter.removeNotificationListener(this, null, null);
      this.cache.getLoggerI18n().fine("Removed Memory MXBean notification listener" + this);
    } catch (ListenerNotFoundException e) {
      this.cache.getLoggerI18n().fine(
          "This instance '" + toString() + "' was not registered as a Memory MXBean listener");
    }

    // Stop the stats listener
    final GemFireStatSampler sampler = this.cache.getDistributedSystem().getStatSampler();
    if (sampler != null) {
      sampler.removeLocalStatListener(this.statListener);
    }

    this.started = false;
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:33,代码来源:HeapMemoryMonitor.java

示例3: removeNotificationListener

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
public void removeNotificationListener(
        ObjectName name, NotificationListener listener,
        NotificationFilter filter, Object handback)
        throws InstanceNotFoundException, ListenerNotFoundException {
    NotificationEmitter userMBean =
            (NotificationEmitter) getMBean(name);
    NotificationListener wrappedListener =
          wrappedListener(name, userMBean, listener);
    userMBean.removeNotificationListener(wrappedListener, filter, handback);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:OldMBeanServerTest.java

示例4: removeNotificationListener

import javax.management.NotificationEmitter; //导入方法依赖的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

示例5: stopMonitoring

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
/**
   * Stops all three mechanisms from monitoring heap usage.
   */
 @Override
public void stopMonitoring() {
    synchronized (this) {
      if (!this.started) {
        return;
      }
      
      // Stop the poller
      this.resourceManager.stopExecutor(this.pollerExecutor);

      // Stop the JVM threshold listener
      NotificationEmitter emitter = (NotificationEmitter) ManagementFactory.getMemoryMXBean();
      try {
        emitter.removeNotificationListener(this, null, null);
        this.cache.getLoggerI18n().fine("Removed Memory MXBean notification listener" + this);
      } catch (ListenerNotFoundException e) {
        this.cache.getLoggerI18n().fine("This instance '" + toString() + "' was not registered as a Memory MXBean listener");
      }

      // Stop the stats listener
      final GemFireStatSampler sampler = this.cache.getDistributedSystem().getStatSampler();
      if (sampler != null) {
        sampler.removeLocalStatListener(this.statListener);
      }

      this.started = false;
    }
  }
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:32,代码来源:HeapMemoryMonitor.java

示例6: shutdown

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
public void shutdown() {
    if (gcLogTailer != null) {
        gcLogTailer.stop();
    }

    for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMXBeans) {
        if (NotificationEmitter.class.isInstance(garbageCollectorMXBean)) {
            NotificationEmitter emitter = NotificationEmitter.class.cast(garbageCollectorMXBean);
            try {
                emitter.removeNotificationListener(gcEventListener);
            } catch (ListenerNotFoundException ignore) {
            }
        }
    }
}
 
开发者ID:centro,项目名称:monitoring-center,代码行数:16,代码来源:GarbageCollectorMetricSet.java

示例7: removeMemoryWarnings

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
public void removeMemoryWarnings() {
  try {
    MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
    NotificationEmitter emitter = (NotificationEmitter) memoryBean;
    emitter.removeNotificationListener(this);
  } catch (ListenerNotFoundException e) {
    // do nothing
  }
}
 
开发者ID:teanalab,项目名称:demidovii,代码行数:10,代码来源:Sorter.java

示例8: removeMemoryWarnings

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
public void removeMemoryWarnings() {
    try {
        MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
        NotificationEmitter emitter = (NotificationEmitter) memoryBean;
        emitter.removeNotificationListener(this);
    } catch (ListenerNotFoundException e) {
        // do nothing
    }
}
 
开发者ID:jjfiv,项目名称:galagosearch,代码行数:10,代码来源:Sorter.java

示例9: terminate

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
@Override
public void terminate() {
  List<GarbageCollectorMXBean> gcMxBeans = java.lang.management.ManagementFactory.getGarbageCollectorMXBeans();
  for (GarbageCollectorMXBean gcMxBean : gcMxBeans) {
    NotificationEmitter emitter = (NotificationEmitter)gcMxBean;

    try {
      emitter.removeNotificationListener(listener);
    } catch (ListenerNotFoundException e) {
      //
    }
  }
}
 
开发者ID:aurbroszniowski,项目名称:Rainfall-core,代码行数:14,代码来源:GcStatisticsCollector.java

示例10: stop

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
/** Stop collecting GC events. */
public synchronized void stop() {
  Preconditions.checkState(notifListener != null, "logger has not been started");
  for (GarbageCollectorMXBean mbean : ManagementFactory.getGarbageCollectorMXBeans()) {
    if (mbean instanceof NotificationEmitter) {
      final NotificationEmitter emitter = (NotificationEmitter) mbean;
      try {
        emitter.removeNotificationListener(notifListener);
      } catch (ListenerNotFoundException e) {
        LOGGER.warn("could not remove gc listener", e);
      }
    }
  }
  notifListener = null;
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:16,代码来源:GcLogger.java

示例11: destroy

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
@Override
public void destroy() {
	memoryMXBean = ManagementFactory.getMemoryMXBean();
	NotificationEmitter emitter = (NotificationEmitter)memoryMXBean;
	List<MemoryPoolMXBean> memPools = ManagementFactory.getMemoryPoolMXBeans();
	for (MemoryPoolMXBean memoryPoolMXBean : memPools) {
		try {
			emitter.removeNotificationListener(this, null, memoryPoolMXBean);
		} catch (Exception e) {	}
	}
}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:12,代码来源:MemMonitor.java

示例12: removeNL

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
private void removeNL(NotificationEmitter b, NotificationFilter f, Object o) {
    try {
        b.removeNotificationListener(this, f, o);
    } catch (ListenerNotFoundException e) {
        fail(e);
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:8,代码来源:NotificationBroadcasterSupportTest.java

示例13: close

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
@Override
public void close() throws IOException {
	try {
		// Remove notification listener
		final NotificationEmitter notificationEmitter = (NotificationEmitter) ManagementFactory.getMemoryMXBean();
		notificationEmitter.removeNotificationListener(this);
	} catch (final ListenerNotFoundException ex) {
		log.warn("Somebody else already removed the notification listener from the MemoryMXBean.", ex);
	}
}
 
开发者ID:whummer,项目名称:scaleDOM,代码行数:11,代码来源:LowMemoryDetector.java

示例14: removeNotificationListener

import javax.management.NotificationEmitter; //导入方法依赖的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

示例15: removeNotificationListener

import javax.management.NotificationEmitter; //导入方法依赖的package包/类
/**
 * Removes the specified listener from the list of recipients
 * of notifications from the supplied bean.  Only the first instance with
 * the supplied filter and passback object is removed.
 * <code>null</code> is used as a valid value for these parameters,
 * rather than as a way to remove all registration instances for
 * the specified listener; for this behaviour instead, see
 * {@link #removeNotificationListener(ObjectName, NotificationListener)}.
 *
 * @param name the name of the management bean from which the
 *             listener should be removed.
 * @param listener the listener to remove.
 * @param filter the filter of the listener to remove.
 * @param passback the passback object of 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(ObjectName, NotificationListener,
 *                               NotificationFilter, Object)
 * @see NotificationEmitter#removeNotificationListener(NotificationListener,
 *                                                     NotificationFilter,
 *                                                     Object)
 */
public void removeNotificationListener(ObjectName name,
                                       NotificationListener listener,
                                       NotificationFilter filter,
                                       Object passback)
  throws InstanceNotFoundException, ListenerNotFoundException
{
  Object bean = getBean(name);
  checkSecurity(name, null, "removeNotificationListener");
  if (bean instanceof NotificationEmitter)
    {
      NotificationEmitter bbean = (NotificationEmitter) bean;
      bbean.removeNotificationListener(listener, filter, passback);
      LazyListenersHolder.listeners.remove(listener);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:44,代码来源:Server.java


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