Search in sources :

Example 1 with PushingJmsListener

use of nl.nn.adapterframework.jms.PushingJmsListener in project iaf by ibissource.

the class DefaultIbisManager method unload.

private void unload(Configuration configuration) {
    configuration.setUnloadInProgressOrDone(true);
    while (configuration.getStartAdapterThreads().size() > 0) {
        log.debug("Waiting for start threads to end: " + configuration.getStartAdapterThreads());
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            log.warn("Interrupted waiting for start threads to end", e);
        }
    }
    stopAdapters(configuration);
    while (configuration.getStopAdapterThreads().size() > 0) {
        log.debug("Waiting for stop threads to end: " + configuration.getStopAdapterThreads());
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            log.warn("Interrupted waiting for stop threads to end", e);
        }
    }
    // destroy all jmsContainers
    for (int i = 0; i < configuration.getRegisteredAdapters().size(); i++) {
        IAdapter adapter = configuration.getRegisteredAdapter(i);
        Iterator recIt = adapter.getReceiverIterator();
        if (recIt.hasNext()) {
            while (recIt.hasNext()) {
                IReceiver receiver = (IReceiver) recIt.next();
                if (receiver instanceof ReceiverBase) {
                    ReceiverBase rb = (ReceiverBase) receiver;
                    IListener listener = rb.getListener();
                    if (listener instanceof PushingJmsListener) {
                        PushingJmsListener pjl = (PushingJmsListener) listener;
                        pjl.destroy();
                    }
                }
            }
        }
    }
    while (configuration.getRegisteredAdapters().size() > 0) {
        IAdapter adapter = configuration.getRegisteredAdapter(0);
        AdapterService adapterService = configuration.getAdapterService();
        adapterService.unRegisterAdapter(adapter);
    }
    configurations.remove(configuration);
}
Also used : AdapterService(nl.nn.adapterframework.configuration.AdapterService) IReceiver(nl.nn.adapterframework.core.IReceiver) ReceiverBase(nl.nn.adapterframework.receivers.ReceiverBase) IListener(nl.nn.adapterframework.core.IListener) Iterator(java.util.Iterator) PushingJmsListener(nl.nn.adapterframework.jms.PushingJmsListener) IAdapter(nl.nn.adapterframework.core.IAdapter)

Aggregations

Iterator (java.util.Iterator)1 AdapterService (nl.nn.adapterframework.configuration.AdapterService)1 IAdapter (nl.nn.adapterframework.core.IAdapter)1 IListener (nl.nn.adapterframework.core.IListener)1 IReceiver (nl.nn.adapterframework.core.IReceiver)1 PushingJmsListener (nl.nn.adapterframework.jms.PushingJmsListener)1 ReceiverBase (nl.nn.adapterframework.receivers.ReceiverBase)1