Java Code Examples for javax.management.ListenerNotFoundException

The following are top voted examples for showing how to use javax.management.ListenerNotFoundException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Pogamut3   File: PogamutMBeanServer.java   Source Code and License 6 votes vote down vote up
@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();
		}
	}		
}
 
Example 2
Project: tomcat7   File: BaseModelMBean.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
    }
 }
 
Example 3
Project: openjdk-jdk10   File: NotificationEmitterSupport.java   Source Code and License 6 votes vote down vote up
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;
    }
}
 
Example 4
Project: openjdk-jdk10   File: ClientNotifForwarder.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 5
Project: jdk8u-jdk   File: RMIConnector.java   Source Code and License 6 votes vote down vote up
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);
    }
}
 
Example 6
Project: OpenJSharp   File: DefaultMBeanServerInterceptor.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 7
Project: openjdk-jdk10   File: ClientNotifForwarder.java   Source Code and License 6 votes vote down vote up
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]);
}
 
Example 8
Project: openjdk-jdk10   File: ThresholdNotificationsTest.java   Source Code and License 6 votes vote down vote up
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());
}
 
Example 9
Project: jdk8u-jdk   File: SnmpMibTable.java   Source Code and License 6 votes vote down vote up
/**
 * 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) ;
}
 
Example 10
Project: OpenJSharp   File: SnmpMibTable.java   Source Code and License 6 votes vote down vote up
/**
 * 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) ;
}
 
Example 11
Project: openjdk-jdk10   File: RMIConnector.java   Source Code and License 6 votes vote down vote up
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);
    }

}
 
Example 12
Project: OpenJSharp   File: RequiredModelMBean.java   Source Code and License 6 votes vote down vote up
/**
 * 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");
    }

}
 
Example 13
Project: jdk8u-jdk   File: NotificationEmitterSupport.java   Source Code and License 6 votes vote down vote up
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;
    }
}
 
Example 14
Project: OpenJSharp   File: RMIConnector.java   Source Code and License 6 votes vote down vote up
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);
    }
}
 
Example 15
Project: jdk8u-jdk   File: DefaultMBeanServerInterceptor.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 16
Project: OpenJSharp   File: RMIConnector.java   Source Code and License 6 votes vote down vote up
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);
    }

}
 
Example 17
Project: openjdk-jdk10   File: RequiredModelMBean.java   Source Code and License 6 votes vote down vote up
/**
 * 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");
    }

}
 
Example 18
Project: monarch   File: MX4JModelMBean.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 19
Project: openjdk-jdk10   File: MBeanServerAccessController.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 20
Project: Pogamut3   File: PogamutMBeanServer.java   Source Code and License 5 votes vote down vote up
@Override
public synchronized void removeNotificationListener(ObjectName name,	NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException,
		ListenerNotFoundException {		
	mbs.removeNotificationListener(name, listener, filter, handback);
	Listener2 l = new Listener2(name, listener, filter, handback);
	listeners.remove(l);
	listeners2.remove(l);
	unregisteredListeners.remove(l);
}
 
Example 21
Project: streamsx.jmxclients   File: JmxConnectionPool.java   Source Code and License 5 votes vote down vote up
protected void removeNotificationListener() {
    if (mConnectionNotificationListener != null) {
        try {
            mConnector
                    .removeConnectionNotificationListener(mConnectionNotificationListener);
        } catch (ListenerNotFoundException e) {
        }
        mConnectionNotificationListener = null;
    }
}
 
Example 22
Project: apache-tomcat-7.0.73-with-comment   File: BaseModelMBean.java   Source Code and License 5 votes vote down vote up
/**
 * Remove an attribute change notification event listener from
 * this MBean.
 *
 * @param listener The listener to be removed
 * @param name The attribute name for which no more events are required
 *
 *
 * @exception ListenerNotFoundException if this listener is not
 *  registered in the MBean
 */
@Override
public void removeAttributeChangeNotificationListener
    (NotificationListener listener, String name)
    throws ListenerNotFoundException {

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

    // FIXME - currently this removes *all* notifications for this listener
    if (attributeBroadcaster != null) {
        attributeBroadcaster.removeNotificationListener(listener);
    }

}
 
Example 23
Project: lazycat   File: BaseModelMBean.java   Source Code and License 5 votes vote down vote up
/**
 * Remove an attribute change notification event listener from this MBean.
 *
 * @param listener
 *            The listener to be removed
 * @param name
 *            The attribute name for which no more events are required
 *
 *
 * @exception ListenerNotFoundException
 *                if this listener is not registered in the MBean
 */
@Override
public void removeAttributeChangeNotificationListener(NotificationListener listener, String name)
		throws ListenerNotFoundException {

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

	// FIXME - currently this removes *all* notifications for this listener
	if (attributeBroadcaster != null) {
		attributeBroadcaster.removeNotificationListener(listener);
	}

}
 
Example 24
Project: jdk8u-jdk   File: MBeanServerAccessController.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 25
Project: jdk8u-jdk   File: JmxMBeanServer.java   Source Code and License 5 votes vote down vote up
public void removeNotificationListener(ObjectName name,
                                       NotificationListener listener)
        throws InstanceNotFoundException, ListenerNotFoundException {

    mbsInterceptor.removeNotificationListener(cloneObjectName(name),
                                              listener);
}
 
Example 26
Project: openjdk-jdk10   File: RMIConnector.java   Source Code and License 5 votes vote down vote up
public void removeNotificationListener(ObjectName name,
        ObjectName listener,
        NotificationFilter filter,
        Object handback)
        throws InstanceNotFoundException,
        ListenerNotFoundException,
        IOException {
    if (logger.debugOn())
        logger.debug("removeNotificationListener" +
                "(ObjectName,ObjectName,NotificationFilter,Object)",
                "name=" + name
                + ", listener=" + listener
                + ", filter=" + filter
                + ", handback=" + handback);

    final MarshalledObject<NotificationFilter> sFilter =
            new MarshalledObject<NotificationFilter>(filter);
    final MarshalledObject<Object> sHandback =
            new MarshalledObject<Object>(handback);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        connection.removeNotificationListener(name,
                listener,
                sFilter,
                sHandback,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        connection.removeNotificationListener(name,
                listener,
                sFilter,
                sHandback,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
 
Example 27
Project: jdk8u-jdk   File: CommunicatorServer.java   Source Code and License 5 votes vote down vote up
/**
 * Removes the specified listener from this CommunicatorServer.
 * Note that if the listener has been registered with different
 * handback objects or notification filters, all entries corresponding
 * to the listener will be removed.
 *
 * @param listener The listener object to be removed.
 *
 * @exception ListenerNotFoundException The listener is not registered.
 */
@Override
public void removeNotificationListener(NotificationListener listener)
    throws ListenerNotFoundException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag,
            "removeNotificationListener","Removing listener "+ listener);
    }
    notifBroadcaster.removeNotificationListener(listener);
}
 
Example 28
Project: lams   File: BaseModelMBean.java   Source Code and License 5 votes vote down vote up
/**
 * 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
 */
public void removeNotificationListener(NotificationListener listener)
    throws ListenerNotFoundException {

    if (listener == null)
        throw new IllegalArgumentException("Listener is null");
    if (generalBroadcaster == null)
        generalBroadcaster = new BaseNotificationBroadcaster();
    generalBroadcaster.removeNotificationListener(listener);


}
 
Example 29
Project: openjdk-jdk10   File: GarbageCollectorExtImpl.java   Source Code and License 5 votes vote down vote up
public synchronized void removeNotificationListener(NotificationListener listener,
                                                    NotificationFilter filter,
                                                    Object handback)
        throws ListenerNotFoundException
{
    boolean before = hasListeners();
    super.removeNotificationListener(listener,filter,handback);
    boolean after = hasListeners();
    if (before && !after) {
        setNotificationEnabled(this,false);
    }
}
 
Example 30
Project: OpenJSharp   File: GarbageCollectorImpl.java   Source Code and License 5 votes vote down vote up
public synchronized void removeNotificationListener(NotificationListener listener)
    throws ListenerNotFoundException {
    boolean before = hasListeners();
    super.removeNotificationListener(listener);
    boolean after = hasListeners();
    if (before && !after) {
        setNotificationEnabled(this,false);
    }
}
 
Example 31
Project: jdk8u-jdk   File: JmxMBeanServer.java   Source Code and License 5 votes vote down vote up
public void removeNotificationListener(ObjectName name,
                                       ObjectName listener,
                                       NotificationFilter filter,
                                       Object handback)
        throws InstanceNotFoundException, ListenerNotFoundException {

    mbsInterceptor.removeNotificationListener(cloneObjectName(name),
                                              listener, filter, handback);
}
 
Example 32
Project: OpenJSharp   File: NotificationEmitterSupport.java   Source Code and License 5 votes vote down vote up
public void removeNotificationListener(NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
        throws ListenerNotFoundException {

    boolean found = false;

    synchronized (listenerLock) {
        List<ListenerInfo> newList = new ArrayList<>(listenerList);
        final int size = newList.size();
        for (int i = 0; i < size; i++) {
            ListenerInfo li =  newList.get(i);

            if (li.listener == listener) {
                found = true;
                if (li.filter == filter
                    && li.handback == handback) {
                    newList.remove(i);
                    listenerList = newList;
                    return;
                }
            }
        }
    }

    if (found) {
        /* We found this listener, but not with the given filter
         * and handback.  A more informative exception message may
         * make debugging easier.  */
        throw new ListenerNotFoundException("Listener not registered " +
                                            "with this filter and " +
                                            "handback");
    } else {
        throw new ListenerNotFoundException("Listener not registered");
    }
}
 
Example 33
Project: OpenJSharp   File: JVM_MANAGEMENT_MIB_IMPL.java   Source Code and License 5 votes vote down vote up
/**
 * Remove notification listener.
 */
public void terminate() {
    try {
        emitter.removeNotificationListener(handler);
    }catch(ListenerNotFoundException e) {
        log.error("terminate", "Listener Not found : " + e);
    }
}
 
Example 34
Project: OpenJSharp   File: DefaultMBeanServerInterceptor.java   Source Code and License 5 votes vote down vote up
public void removeNotificationListener(ObjectName name,
                                       NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
        throws InstanceNotFoundException, ListenerNotFoundException {
    removeNotificationListener(name, listener, filter, handback, false);
}
 
Example 35
Project: OpenJSharp   File: JmxMBeanServer.java   Source Code and License 5 votes vote down vote up
public void removeNotificationListener(ObjectName name,
                                       NotificationListener listener)
        throws InstanceNotFoundException, ListenerNotFoundException {

    mbsInterceptor.removeNotificationListener(cloneObjectName(name),
                                              listener);
}
 
Example 36
Project: jdk8u-jdk   File: NotificationEmitterSupport.java   Source Code and License 5 votes vote down vote up
public void removeNotificationListener(NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
        throws ListenerNotFoundException {

    boolean found = false;

    synchronized (listenerLock) {
        List<ListenerInfo> newList = new ArrayList<>(listenerList);
        final int size = newList.size();
        for (int i = 0; i < size; i++) {
            ListenerInfo li =  newList.get(i);

            if (li.listener == listener) {
                found = true;
                if (li.filter == filter
                    && li.handback == handback) {
                    newList.remove(i);
                    listenerList = newList;
                    return;
                }
            }
        }
    }

    if (found) {
        /* We found this listener, but not with the given filter
         * and handback.  A more informative exception message may
         * make debugging easier.  */
        throw new ListenerNotFoundException("Listener not registered " +
                                            "with this filter and " +
                                            "handback");
    } else {
        throw new ListenerNotFoundException("Listener not registered");
    }
}
 
Example 37
Project: openjdk-jdk10   File: MBeanServerAccessController.java   Source Code and License 5 votes vote down vote up
/**
 * Call <code>checkRead()</code>, then forward this method to the
 * wrapped object.
 */
public void removeNotificationListener(ObjectName name,
                                       NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
    throws InstanceNotFoundException, ListenerNotFoundException {
    checkRead();
    getMBeanServer().removeNotificationListener(name, listener,
                                                filter, handback);
}
 
Example 38
Project: openjdk-jdk10   File: RMIConnector.java   Source Code and License 5 votes vote down vote up
public void
        removeConnectionNotificationListener(NotificationListener listener,
        NotificationFilter filter,
        Object handback)
        throws ListenerNotFoundException {
    if (listener == null)
        throw new NullPointerException("listener");
    connectionBroadcaster.removeNotificationListener(listener, filter,
            handback);
}
 
Example 39
Project: jdk8u-jdk   File: RMIConnector.java   Source Code and License 5 votes vote down vote up
public void removeNotificationListener(ObjectName name,
        NotificationListener listener)
        throws InstanceNotFoundException,
        ListenerNotFoundException,
        IOException {

    final boolean debug = logger.debugOn();

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

    final Integer[] ret =
            rmiNotifClient.removeNotificationListener(name, listener);

    if (debug) logger.debug("removeNotificationListener",
            "listenerIDs=" + objects(ret));

    final ClassLoader old = pushDefaultClassLoader();

    try {
        connection.removeNotificationListeners(name,
                ret,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        connection.removeNotificationListeners(name,
                ret,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }

}
 
Example 40
Project: OpenJSharp   File: ClientNotifForwarder.java   Source Code and License 5 votes vote down vote up
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 id = null;

    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, filter, handback)) {
            id=li.getListenerID();

            infoList.remove(id);

            break;
        }
    }

    if (id == null)
        throw new ListenerNotFoundException("Listener not found");

    return id;
}