Search in sources :

Example 6 with QueueTransaction

use of com.swiftmq.swiftlet.queue.QueueTransaction in project swiftmq-ce by iitsoftware.

the class TransactionManager method rollback.

synchronized void rollback(boolean start) throws Exception {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/rollback");
    for (Iterator iter = transactions.iterator(); iter.hasNext(); ) {
        QueueTransaction t = (QueueTransaction) iter.next();
        t.rollback();
    }
    if (start)
        startTransactions();
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/rollback done");
}
Also used : Iterator(java.util.Iterator) QueueTransaction(com.swiftmq.swiftlet.queue.QueueTransaction)

Example 7 with QueueTransaction

use of com.swiftmq.swiftlet.queue.QueueTransaction in project swiftmq-ce by iitsoftware.

the class TransactionManager method commit.

synchronized void commit() throws Exception {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/commit");
    for (Iterator iter = transactions.iterator(); iter.hasNext(); ) {
        QueueTransaction t = (QueueTransaction) iter.next();
        t.commit();
    }
    startTransactions();
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/commit done");
}
Also used : Iterator(java.util.Iterator) QueueTransaction(com.swiftmq.swiftlet.queue.QueueTransaction)

Example 8 with QueueTransaction

use of com.swiftmq.swiftlet.queue.QueueTransaction in project swiftmq-ce by iitsoftware.

the class TransactionManager method rollback.

synchronized void rollback(boolean start) throws Exception {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/rollback");
    for (Iterator iter = transactions.iterator(); iter.hasNext(); ) {
        QueueTransaction t = (QueueTransaction) iter.next();
        t.rollback();
    }
    if (start)
        startTransactions();
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/rollback done");
}
Also used : Iterator(java.util.Iterator) QueueTransaction(com.swiftmq.swiftlet.queue.QueueTransaction)

Example 9 with QueueTransaction

use of com.swiftmq.swiftlet.queue.QueueTransaction in project swiftmq-ce by iitsoftware.

the class TransactionManager method startTransactions.

synchronized void startTransactions() throws Exception {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/startTransactions");
    transactions.clear();
    for (Iterator iter = transactionFactories.iterator(); iter.hasNext(); ) {
        TransactionFactory f = (TransactionFactory) iter.next();
        if (!f.isMarkedForClose()) {
            try {
                QueueTransaction t = f.createTransaction();
                if (ctx.traceSpace.enabled)
                    ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/startTransactions, add=" + t + ", closed=" + t.isClosed());
                transactions.add(t);
            } catch (Exception e) {
                if (ctx.traceSpace.enabled)
                    ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/startTransactions, e=" + e + ", remove transaction factory.");
                iter.remove();
            }
        } else
            iter.remove();
    }
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/startTransactions done");
}
Also used : Iterator(java.util.Iterator) QueueTransactionClosedException(com.swiftmq.swiftlet.queue.QueueTransactionClosedException) QueueTransaction(com.swiftmq.swiftlet.queue.QueueTransaction)

Example 10 with QueueTransaction

use of com.swiftmq.swiftlet.queue.QueueTransaction in project swiftmq-ce by iitsoftware.

the class TransactionManager method rollback.

synchronized void rollback(boolean start) throws Exception {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/rollback");
    for (Iterator iter = transactions.iterator(); iter.hasNext(); ) {
        QueueTransaction t = (QueueTransaction) iter.next();
        t.rollback();
    }
    if (start)
        startTransactions();
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + "/rollback done");
}
Also used : Iterator(java.util.Iterator) QueueTransaction(com.swiftmq.swiftlet.queue.QueueTransaction)

Aggregations

QueueTransaction (com.swiftmq.swiftlet.queue.QueueTransaction)15 Iterator (java.util.Iterator)13 AbstractQueue (com.swiftmq.swiftlet.queue.AbstractQueue)2 QueueTransactionClosedException (com.swiftmq.swiftlet.queue.QueueTransactionClosedException)2 XAContextException (com.swiftmq.swiftlet.xa.XAContextException)2 XAException (javax.transaction.xa.XAException)2 QueuePushTransaction (com.swiftmq.swiftlet.queue.QueuePushTransaction)1