protected synchronized void afterClose()

in jbi/cluster/requestor/src/main/java/org/apache/servicemix/jbi/cluster/requestor/ActiveMQJmsRequestorPool.java [338:360]


        protected synchronized void afterClose() throws JMSException {
            if (isRunning() && consumer != null && sameSelector(getMessageSelector(), consumer.getMessageSelector())) {
                if (message != null) {
                    rescheduleTaskIfNecessary(this);
                    return;
                } else {
                    // This is not atomic, which means we may end up with more than maxConsumers
                    // elements in the polling queue
                    synchronized (lifecycleMonitor) {
                        if (polling.size() < getMaxConcurrentConsumers()) {
                            polling.add(this);
                            return;
                        }
                    }
                }
            }
            if (cacheSessions && session != null) {
                destroyConsumer();
                requestors.add(this);
            } else {
                destroy();
            }
        }