Search in sources :

Example 6 with QueueIndexEntry

use of com.swiftmq.impl.store.standard.index.QueueIndexEntry in project swiftmq-ce by iitsoftware.

the class StoreWriteTransactionImpl method abort.

public void abort(XidImpl globalTxId) throws StoreException {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/abort, globalTxId: " + globalTxId);
    txId = ctx.transactionManager.createTxId();
    sem = new Semaphore();
    journal = new ArrayList();
    queueIndex.setJournal(journal);
    try {
        for (int i = 0; i < keys.size(); i++) {
            addMessagePageReference(queueIndex.remove((QueueIndexEntry) keys.get(i)));
        }
        ctx.recoveryManager.commit(new CommitLogRecord(txId, sem, journal, this, messagePageRefs));
        sem.waitHere();
        ctx.transactionManager.removeTxId(txId);
    } catch (Exception e) {
        throw new StoreException(e.toString());
    }
    if (prepareLogRecord != null) {
        try {
            ctx.preparedLog.remove(prepareLogRecord);
        } catch (IOException e) {
            throw new StoreException(e.toString());
        }
        prepareLogRecord = null;
    }
    close();
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/abort, globalTxId: " + globalTxId + ", done");
}
Also used : CommitLogRecord(com.swiftmq.impl.store.standard.log.CommitLogRecord) ArrayList(java.util.ArrayList) Semaphore(com.swiftmq.tools.concurrent.Semaphore) IOException(java.io.IOException) QueueIndexEntry(com.swiftmq.impl.store.standard.index.QueueIndexEntry) StoreException(com.swiftmq.swiftlet.store.StoreException) IOException(java.io.IOException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Aggregations

QueueIndexEntry (com.swiftmq.impl.store.standard.index.QueueIndexEntry)6 ArrayList (java.util.ArrayList)5 StoreException (com.swiftmq.swiftlet.store.StoreException)3 IOException (java.io.IOException)3 CommitLogRecord (com.swiftmq.impl.store.standard.log.CommitLogRecord)2 List (java.util.List)2 BytesMessageImpl (com.swiftmq.jms.BytesMessageImpl)1 StoreEntry (com.swiftmq.swiftlet.store.StoreEntry)1 AsyncCompletionCallback (com.swiftmq.tools.concurrent.AsyncCompletionCallback)1 Semaphore (com.swiftmq.tools.concurrent.Semaphore)1