Search in sources :

Example 1 with IListenerConnector

use of nl.nn.adapterframework.core.IListenerConnector in project iaf by ibissource.

the class ListenerPortPoller method poll.

/**
 * Poll all registered EjbListenerPortConnector instances to see if they
 * are in the same state as their associated listener-ports, and
 * toggle their state if not.
 */
public void poll() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    // }
    for (Iterator iter = portConnectorList.iterator(); iter.hasNext(); ) {
        WeakReference wr = (WeakReference) iter.next();
        IListenerConnector elpc = (IListenerConnector) wr.get();
        if (elpc == null) {
            iter.remove();
            continue;
        }
        // Check for each ListenerPort if it's state matches with the
        // state that IBIS thinks it should be in.
        IPortConnectedListener listener = getListener(elpc);
        try {
            if (isClosed(elpc) != isListenerPortClosed(elpc)) {
                log.info("State of listener [" + listener.getName() + "] does not match state of WebSphere ListenerPort [" + // + elpc.getListenerPortName(listener)
                "] to which it is attached; will try to change state of Receiver [" + listener.getReceiver().getName() + "]");
                toggleConfiguratorState(elpc);
            }
        } catch (Exception ex) {
            log.error("Cannot change, or enquire on, state of Listener [" + listener.getName() + "]", ex);
        }
    }
// if (log.isDebugEnabled()) {
// log.debug("Exit polling " + this.toString() + ", thread: " + Thread.currentThread().getName());
// }
}
Also used : WeakReference(java.lang.ref.WeakReference) Iterator(java.util.Iterator) IPortConnectedListener(nl.nn.adapterframework.core.IPortConnectedListener) IListenerConnector(nl.nn.adapterframework.core.IListenerConnector) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ListenerException(nl.nn.adapterframework.core.ListenerException)

Aggregations

WeakReference (java.lang.ref.WeakReference)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Iterator (java.util.Iterator)1 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)1 IListenerConnector (nl.nn.adapterframework.core.IListenerConnector)1 IPortConnectedListener (nl.nn.adapterframework.core.IPortConnectedListener)1 ListenerException (nl.nn.adapterframework.core.ListenerException)1