Search in sources :

Example 1 with PartitionNotFoundException

use of com.sun.messaging.jmq.jmsserver.util.PartitionNotFoundException in project openmq by eclipse-ee4j.

the class Subscription method releaseConsumer.

public void releaseConsumer(ConsumerUID uid) {
    logger.log(Logger.DEBUG, "Releasing Consumer " + uid + " from durable " + this);
    pause("Subscription: releaseConsumer " + uid);
    Consumer consumer = null;
    synchronized (subLock) {
        consumer = (Consumer) activeConsumers.remove(uid);
        consumer.pause("Subscription: releaseConsumer B ");
        consumer.setParentList(new NoPersistPartitionedStoreImpl(getStoredConsumerUID()), null);
        active = !activeConsumers.isEmpty();
    }
    List[] ll = null;
    try {
        ll = DestinationList.findMatchingIDs(null, getDestinationUID());
    } catch (PartitionNotFoundException e) {
        ll = new List[] { new ArrayList<DestinationUID>() };
    }
    List l = ll[0];
    Iterator itr = l.iterator();
    Destination[] ds = null;
    Destination d = null;
    while (itr.hasNext()) {
        ds = DestinationList.getDestination(null, (DestinationUID) itr.next());
        d = ds[0];
        if (d != null) {
            d.notifyConsumerRemoved();
        }
    }
    if (!isDurable) {
        synchronized (Subscription.class) {
            active = !activeConsumers.isEmpty();
            if (!active) {
                logger.log(Logger.DEBUG, "Cleaning up non-durable " + " subscription " + this);
                String key = getNDSubKey(clientID, consumer.getDestinationUID(), selstr, getNDSubscriptionName());
                nonDurableList.remove(key);
                destroyConsumer(new HashSet(), (Map) null, false, true, false);
            }
        }
    }
    consumer.resume("Subscription: releaseConsumer B ");
    resume("Subscription: release consumer " + uid);
}
Also used : NoPersistPartitionedStoreImpl(com.sun.messaging.jmq.jmsserver.persist.api.NoPersistPartitionedStoreImpl) PartitionNotFoundException(com.sun.messaging.jmq.jmsserver.util.PartitionNotFoundException)

Aggregations

NoPersistPartitionedStoreImpl (com.sun.messaging.jmq.jmsserver.persist.api.NoPersistPartitionedStoreImpl)1 PartitionNotFoundException (com.sun.messaging.jmq.jmsserver.util.PartitionNotFoundException)1