Search in sources :

Example 16 with BaseTransaction

use of com.sun.messaging.jmq.jmsserver.data.BaseTransaction in project openmq by eclipse-ee4j.

the class BaseTransactionManager method removeFromIncompleteUnstored.

BaseTransaction removeFromIncompleteUnstored(TransactionUID tid) {
    BaseTransaction result = incompleteUnstored.remove(tid);
    if (Store.getDEBUG()) {
        String msg = getPrefix() + " removing  " + tid + " from incompleteUnstored. Total = " + incompleteUnstored.size();
        logger.log(Logger.DEBUG, msg);
    }
    return result;
}
Also used : BaseTransaction(com.sun.messaging.jmq.jmsserver.data.BaseTransaction)

Example 17 with BaseTransaction

use of com.sun.messaging.jmq.jmsserver.data.BaseTransaction in project openmq by eclipse-ee4j.

the class BaseTransactionManager method writePreparedTransactionsToPreparedTxnStoreOnCheckpoint.

// on checkpoint, we need to store any newly logged prepared transactions to the preparedTxnStore
// as the transaction log is about to be reset
void writePreparedTransactionsToPreparedTxnStoreOnCheckpoint() throws BrokerException {
    if (Store.getDEBUG()) {
        String msg = getPrefix() + " writePreparedTransactionsToPreparedTxnStoreOnCheckpoint" + " num incompleteUnstored=" + incompleteUnstored.size();
        logger.log(Logger.DEBUG, msg);
    }
    ArrayList<TransactionUID> incmps = null;
    synchronized (incompleteUnstored) {
        incmps = new ArrayList<>(incompleteUnstored.keySet());
    }
    TransactionUID tid = null;
    BaseTransaction baseTxn = null;
    Iterator<TransactionUID> iter = incmps.iterator();
    while (iter.hasNext()) {
        tid = iter.next();
        if (!preparedTxnStore.containsTransaction(tid)) {
            baseTxn = incompleteUnstored.get(tid);
            if (baseTxn == null) {
                continue;
            }
            if (Store.getDEBUG()) {
                String msg = getPrefix() + " transaction storing preparedTransaction " + baseTxn;
                logger.log(Logger.DEBUG, msg);
            }
            try {
                preparedTxnStore.storeTransaction(baseTxn, true);
                addToIncompleteStored(baseTxn);
            } catch (IOException ioe) {
                throw new BrokerException("failed to store transaction in preparedTxnStore " + baseTxn, ioe);
            }
        } else {
            String msg = getPrefix() + " transaction already exists in preparedTxnStore " + tid + "[" + incompleteUnstored.get(tid) + "]";
            logger.log(Logger.INFO, msg);
        }
    }
    incompleteUnstored.clear();
}
Also used : TransactionUID(com.sun.messaging.jmq.jmsserver.data.TransactionUID) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) BaseTransaction(com.sun.messaging.jmq.jmsserver.data.BaseTransaction) IOException(java.io.IOException)

Aggregations

BaseTransaction (com.sun.messaging.jmq.jmsserver.data.BaseTransaction)17 IOException (java.io.IOException)8 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)6 TransactionUID (com.sun.messaging.jmq.jmsserver.data.TransactionUID)5 LocalTransaction (com.sun.messaging.jmq.jmsserver.data.LocalTransaction)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 DestinationList (com.sun.messaging.jmq.jmsserver.core.DestinationList)2 TransactionList (com.sun.messaging.jmq.jmsserver.data.TransactionList)2 TransactionState (com.sun.messaging.jmq.jmsserver.data.TransactionState)2 Agent (com.sun.messaging.jmq.jmsserver.management.agent.Agent)2 PartitionedStore (com.sun.messaging.jmq.jmsserver.persist.api.PartitionedStore)2 CacheHashMap (com.sun.messaging.jmq.util.CacheHashMap)2 SizeString (com.sun.messaging.jmq.util.SizeString)2 List (java.util.List)2 Packet (com.sun.messaging.jmq.io.Packet)1 SysMessageID (com.sun.messaging.jmq.io.SysMessageID)1 GlobalProperties (com.sun.messaging.jmq.jmsserver.GlobalProperties)1 Consumer (com.sun.messaging.jmq.jmsserver.core.Consumer)1 ConsumerUID (com.sun.messaging.jmq.jmsserver.core.ConsumerUID)1