當前位置: 首頁>>代碼示例>>Java>>正文


Java ListenerNotFoundException類代碼示例

本文整理匯總了Java中javax.management.ListenerNotFoundException的典型用法代碼示例。如果您正苦於以下問題:Java ListenerNotFoundException類的具體用法?Java ListenerNotFoundException怎麽用?Java ListenerNotFoundException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ListenerNotFoundException類屬於javax.management包,在下文中一共展示了ListenerNotFoundException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: removeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
@Override
public synchronized void removeNotificationListener(ObjectName name, ObjectName listener)
		throws InstanceNotFoundException, ListenerNotFoundException {
	mbs.removeNotificationListener(name, listener);

	// TODO: slow implementation ... but fast one takes a lot of time to do :-)
	Iterator<Listener1> iter = listeners1.iterator();
	while(iter.hasNext()) {
		Listener1 l = iter.next();
		if (SafeEquals.equals(name, l.name) && SafeEquals.equals(listener, l.listener)) {
			listeners.remove(l);
			unregisteredListeners.remove(l);
			iter.remove();
		}
	}		
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:17,代碼來源:PogamutMBeanServer.java

示例2: removeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
/**
 * Remove a notification event listener from this MBean.
 *
 * @param listener The listener to be removed (any and all registrations
 *  for this listener will be eliminated)
 *
 * @exception ListenerNotFoundException if this listener is not
 *  registered in the MBean
 */
@Override
public void removeNotificationListener(NotificationListener listener)
    throws ListenerNotFoundException {

    if (listener == null)
        throw new IllegalArgumentException("Listener is null");

    if (generalBroadcaster != null) {
        generalBroadcaster.removeNotificationListener(listener);
    }

    if (attributeBroadcaster != null) {
        attributeBroadcaster.removeNotificationListener(listener);
    }
 }
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:25,代碼來源:BaseModelMBean.java

示例3: removeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
public void removeNotificationListener(NotificationListener listener)
    throws ListenerNotFoundException {

    synchronized (listenerLock) {
        List<ListenerInfo> newList = new ArrayList<>(listenerList);
        /* We scan the list of listeners in reverse order because
           in forward order we would have to repeat the loop with
           the same index after a remove.  */
        for (int i=newList.size()-1; i>=0; i--) {
            ListenerInfo li = newList.get(i);

            if (li.listener == listener)
                newList.remove(i);
        }
        if (newList.size() == listenerList.size())
            throw new ListenerNotFoundException("Listener not registered");
        listenerList = newList;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:NotificationEmitterSupport.java

示例4: removeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
public synchronized Integer
    removeNotificationListener(ObjectName name,
                               NotificationListener listener,
                               NotificationFilter filter,
                               Object handback)
        throws ListenerNotFoundException, IOException {

    if (logger.traceOn()) {
        logger.trace("removeNotificationListener",
                     "Remove the listener "+listener+" from "+name);
    }

    beforeRemove();
    Integer liId = getListenerId(name, listener,
            filter, handback);
    infoList.remove(liId);

    return liId;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:ClientNotifForwarder.java

示例5: removeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
public void removeNotificationListener(ObjectName name,
        ObjectName listener)
        throws InstanceNotFoundException,
        ListenerNotFoundException,
        IOException {

    if (logger.debugOn()) logger.debug("removeNotificationListener" +
            "(ObjectName,ObjectName)",
            "name=" + name
            + ", listener=" + listener);

    final ClassLoader old = pushDefaultClassLoader();
    try {
        connection.removeNotificationListener(name,
                listener,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        connection.removeNotificationListener(name,
                listener,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:27,代碼來源:RMIConnector.java

示例6: getListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
private NotificationListener getListener(ObjectName listener)
    throws ListenerNotFoundException {
    // ----------------
    // Get listener object
    // ----------------
    DynamicMBean instance;
    try {
        instance = getMBean(listener);
    } catch (InstanceNotFoundException e) {
        throw EnvHelp.initCause(
                      new ListenerNotFoundException(e.getMessage()), e);
    }

    Object resource = getResource(instance);
    if (!(resource instanceof NotificationListener)) {
        final RuntimeException exc =
            new IllegalArgumentException(listener.getCanonicalName());
        final String msg =
            "MBean " + listener.getCanonicalName() + " does not " +
            "implement " + NotificationListener.class.getName();
        throw new RuntimeOperationsException(exc, msg);
    }
    return (NotificationListener) resource;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:25,代碼來源:DefaultMBeanServerInterceptor.java

示例7: getListenerIds

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
public synchronized Integer[]
getListenerIds(ObjectName name,
               NotificationListener listener)
        throws ListenerNotFoundException, IOException {

    List<Integer> ids = new ArrayList<Integer>();
    List<ClientListenerInfo> values =
            new ArrayList<ClientListenerInfo>(infoList.values());
    for (int i=values.size()-1; i>=0; i--) {
        ClientListenerInfo li = values.get(i);

        if (li.sameAs(name, listener)) {
            ids.add(li.getListenerID());
        }
    }

    if (ids.isEmpty())
        throw new ListenerNotFoundException("Listener not found");

    return ids.toArray(new Integer[0]);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:ClientNotifForwarder.java

示例8: runTest

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
protected void runTest() {
    int iterationsCount
            = Integer.getInteger("jdk.test.lib.iterations", 1);
    MemoryPoolMXBean bean = btype.getMemoryPool();
    ((NotificationEmitter) ManagementFactory.getMemoryMXBean()).
            addNotificationListener(this, null, null);
    for (int i = 0; i < iterationsCount; i++) {
        CodeCacheUtils.hitUsageThreshold(bean, btype);
    }
    Asserts.assertTrue(
            Utils.waitForCondition(
                    () -> (CodeCacheUtils.isCodeHeapPredictable(btype) ?
                            (counter == iterationsCount) : (counter >= iterationsCount)),
                    WAIT_TIME),
            "Couldn't receive expected notifications count");
    try {
        ((NotificationEmitter) ManagementFactory.getMemoryMXBean()).
                removeNotificationListener(this);
    } catch (ListenerNotFoundException ex) {
        throw new AssertionError("Can't remove notification listener", ex);
    }
    System.out.printf("INFO: Scenario finished successfully for %s%n",
            bean.getName());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:ThresholdNotificationsTest.java

示例9: removeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
/**
 * Enable to remove an SNMP entry listener from this
 * <CODE>SnmpMibTable</CODE>.
 *
 * @param listener The listener object which will handle the
 *    notifications emitted by the registered MBean.
 *    This method will remove all the information related to this
 *    listener.
 *
 * @exception ListenerNotFoundException The listener is not registered
 *    in the MBean.
 */
@Override
public synchronized void
    removeNotificationListener(NotificationListener listener)
    throws ListenerNotFoundException {

    // looking for listener in handbackTable
    //
    java.util.Vector<?> handbackList = handbackTable.get(listener) ;
    if ( handbackList == null ) {
        throw new ListenerNotFoundException("listener");
    }

    // If handback is null, remove the listener entry
    //
    handbackTable.remove(listener) ;
    filterTable.remove(listener) ;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:30,代碼來源:SnmpMibTable.java

示例10: removeListenerForMBeanRemovedNotif

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
protected void removeListenerForMBeanRemovedNotif(Integer id)
throws IOException, InstanceNotFoundException,
        ListenerNotFoundException {
    try {
        connection.removeNotificationListeners(
                MBeanServerDelegate.DELEGATE_NAME,
                new Integer[] {id},
                null);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        connection.removeNotificationListeners(
                MBeanServerDelegate.DELEGATE_NAME,
                new Integer[] {id},
                null);
    }

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:RMIConnector.java

示例11: removeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
/**
 * Removes a listener for Notifications from the RequiredModelMBean.
 *
 * @param listener The listener name which was handling notifications
 *    emitted by the registered MBean.
 *    This method will remove all information related to this listener.
 *
 * @exception ListenerNotFoundException The listener is not registered
 *    in the MBean or is null.
 *
 * @see #addNotificationListener
 **/
public void removeNotificationListener(NotificationListener listener)
    throws ListenerNotFoundException {
    if (listener == null)
        throw new ListenerNotFoundException(
                  "Notification listener is null");

    final String mth="removeNotificationListener(NotificationListener)";
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                RequiredModelMBean.class.getName(), mth, "Entry");
    }

    if (generalBroadcaster == null)
        throw new ListenerNotFoundException(
              "No notification listeners registered");


    generalBroadcaster.removeNotificationListener(listener);
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                RequiredModelMBean.class.getName(), mth, "Exit");
    }

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:37,代碼來源:RequiredModelMBean.java

示例12: removeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
/**
 * Removes a listener for Notifications from the RequiredModelMBean.
 *
 * @param listener The listener name which was handling notifications
 *    emitted by the registered MBean.
 *    This method will remove all information related to this listener.
 *
 * @exception ListenerNotFoundException The listener is not registered
 *    in the MBean or is null.
 *
 * @see #addNotificationListener
 **/
public void removeNotificationListener(NotificationListener listener)
    throws ListenerNotFoundException {
    if (listener == null)
        throw new ListenerNotFoundException(
                  "Notification listener is null");

    if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
            MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
    }

    if (generalBroadcaster == null)
        throw new ListenerNotFoundException(
              "No notification listeners registered");


    generalBroadcaster.removeNotificationListener(listener);
    if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
        MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
    }

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:34,代碼來源:RequiredModelMBean.java

示例13: removeAttributeChangeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
private void removeAttributeChangeNotificationListener(NotificationListener listener,
    String attributeName, Object handback)
    throws MBeanException, RuntimeOperationsException, ListenerNotFoundException {
  if (listener == null)
    throw new RuntimeOperationsException(new IllegalArgumentException(
        LocalizedStrings.MX4JModelMBean_LISTENER_CANNOT_BE_NULL.toLocalizedString()));
  AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
  if (attributeName != null) {
    filter.enableAttribute(attributeName);
  } else {
    MBeanAttributeInfo[] ai = m_modelMBeanInfo.getAttributes();
    for (int i = 0; i < ai.length; i++) {
      Descriptor d = ((ModelMBeanAttributeInfo) ai[i]).getDescriptor();
      filter.enableAttribute((String) d.getFieldValue("name"));
    }
  }

  getAttributeChangeBroadcaster().removeNotificationListener(listener, filter, handback);

  Logger logger = getLogger();
  if (logger.isEnabledFor(Logger.DEBUG))
    logger.debug("Listener " + listener + " for attribute " + attributeName
        + " removed successfully, handback is " + handback);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:25,代碼來源:MX4JModelMBean.java

示例14: removeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
public void removeNotificationListener(ObjectName name,
                                       ObjectName listener)
    throws InstanceNotFoundException, ListenerNotFoundException {
    checkRead();
    getMBeanServer().removeNotificationListener(name, listener);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:MBeanServerAccessController.java

示例15: removeNotificationListener

import javax.management.ListenerNotFoundException; //導入依賴的package包/類
protected void removeNotificationListener() {
    if (mConnectionNotificationListener != null) {
        try {
            mConnector
                    .removeConnectionNotificationListener(mConnectionNotificationListener);
        } catch (ListenerNotFoundException e) {
        }
        mConnectionNotificationListener = null;
    }
}
 
開發者ID:IBMStreams,項目名稱:streamsx.jmxclients,代碼行數:11,代碼來源:JmxConnectionPool.java


注:本文中的javax.management.ListenerNotFoundException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。