當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。