Search in sources :

Example 76 with Destination

use of com.sun.messaging.jmq.jmsserver.core.Destination in project openmq by eclipse-ee4j.

the class TransactionLogReplayer method replayRemoteAcks.

public void replayRemoteAcks(TransactionAcknowledgement[] txnAcks, DestinationUID[] destIds, TransactionUID tid, HashSet dstLoadedSet) throws IOException, BrokerException {
    if (Store.getDEBUG()) {
        String msg = getPrefix() + " replayRemoteAcks ";
        logger.log(Logger.INFO, msg);
    }
    for (int i = 0; i < txnAcks.length; i++) {
        TransactionAcknowledgement txnAck = txnAcks[i];
        DestinationUID destId = destIds[i];
        SysMessageID mid = txnAck.getSysMessageID();
        ConsumerUID iid = txnAck.getStoredConsumerUID();
        // Destination dest = DestinationList.getDestination(msgStore.parent, destId);
        // make sure it is loaded
        int type = (destId.isQueue() ? DestType.DEST_TYPE_QUEUE : DestType.DEST_TYPE_TOPIC);
        Destination[] ds = DestinationList.getDestination(msgStore.parent, destId.getName(), type, true, true);
        Destination dest = ds[0];
        dest.load();
        PacketReference pr = dest.getMessage(mid);
        if (pr == null) {
            // could have been acknowledged already?
            // TO DO check this further
            String msg = " could not find packet for replayed message ack " + txnAck + " dest " + destId + " in transaction " + tid;
            logger.log(Logger.WARNING, msg);
        } else {
            if (msgStore.containsMessage(destId, mid)) {
                logger.log(logger.FORCE, BrokerResources.I_UPDATE_INT_STATE_TXNLOG, iid, mid);
                // use try using the correct value; see bug 6516160
                if (dest.isQueue() && iid.longValue() != 0) {
                    msgStore.updateInterestState(destId, mid, PacketReference.getQueueUID(), PartitionedStore.INTEREST_STATE_ACKNOWLEDGED, false);
                } else {
                    msgStore.updateInterestState(destId, mid, iid, PartitionedStore.INTEREST_STATE_ACKNOWLEDGED, false);
                }
                acknowledgeOnReplay(dest, mid, iid);
            } else {
                logger.log(logger.FORCE, BrokerResources.I_DISREGARD_INT_STATE_TXNLOG, iid, mid);
            }
        }
    }
}
Also used : Destination(com.sun.messaging.jmq.jmsserver.core.Destination) TransactionAcknowledgement(com.sun.messaging.jmq.jmsserver.data.TransactionAcknowledgement) DestinationUID(com.sun.messaging.jmq.jmsserver.core.DestinationUID) ConsumerUID(com.sun.messaging.jmq.jmsserver.core.ConsumerUID) PacketReference(com.sun.messaging.jmq.jmsserver.core.PacketReference) SysMessageID(com.sun.messaging.jmq.io.SysMessageID)

Aggregations

Destination (com.sun.messaging.jmq.jmsserver.core.Destination)76 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)39 Iterator (java.util.Iterator)29 DestinationUID (com.sun.messaging.jmq.jmsserver.core.DestinationUID)25 PacketReference (com.sun.messaging.jmq.jmsserver.core.PacketReference)25 ConsumerUID (com.sun.messaging.jmq.jmsserver.core.ConsumerUID)20 SelectorFormatException (com.sun.messaging.jmq.util.selector.SelectorFormatException)18 HashMap (java.util.HashMap)18 Consumer (com.sun.messaging.jmq.jmsserver.core.Consumer)17 IOException (java.io.IOException)16 SysMessageID (com.sun.messaging.jmq.io.SysMessageID)15 ArrayList (java.util.ArrayList)12 List (java.util.List)11 Packet (com.sun.messaging.jmq.io.Packet)9 AckEntryNotFoundException (com.sun.messaging.jmq.jmsserver.util.AckEntryNotFoundException)9 Map (java.util.Map)9 DestinationList (com.sun.messaging.jmq.jmsserver.core.DestinationList)8 SizeString (com.sun.messaging.jmq.util.SizeString)8 PartitionedStore (com.sun.messaging.jmq.jmsserver.persist.api.PartitionedStore)7 ConsumerAlreadyAddedException (com.sun.messaging.jmq.jmsserver.util.ConsumerAlreadyAddedException)7