Search in sources :

Example 16 with StoreException

use of com.swiftmq.swiftlet.store.StoreException in project swiftmq-ce by iitsoftware.

the class NonPersistentStoreImpl method insert.

public void insert(StoreEntry storeEntry) throws StoreException {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/insert, storeEntry=" + storeEntry);
    try {
        checkSwapFile();
        SwapAddress sa = new SwapAddress();
        sa.swapFile = actSwapFile;
        sa.filePointer = sa.swapFile.add(storeEntry);
        storeEntry.key = sa;
    } catch (Exception e) {
        throw new StoreException(e.getMessage());
    }
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/insert done, storeEntry=" + storeEntry);
}
Also used : SwapAddress(com.swiftmq.impl.store.standard.swap.SwapAddress) StoreException(com.swiftmq.swiftlet.store.StoreException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Example 17 with StoreException

use of com.swiftmq.swiftlet.store.StoreException in project swiftmq-ce by iitsoftware.

the class StoreReadTransactionImpl method commit.

public void commit(XidImpl globalTxId) throws StoreException {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/commit, globalTxId: " + globalTxId);
    try {
        ctx.preparedLog.remove(prepareLogRecord);
        commit();
    } catch (IOException e) {
        throw new StoreException(e.toString());
    }
    prepareLogRecord = null;
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/commit, globalTxId: " + globalTxId + ", done");
}
Also used : IOException(java.io.IOException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Example 18 with StoreException

use of com.swiftmq.swiftlet.store.StoreException in project swiftmq-ce by iitsoftware.

the class StoreReadTransactionImpl method commit.

public void commit() throws StoreException {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/commit...");
    if (closed)
        throw new StoreException("Transaction is closed");
    txId = ctx.transactionManager.createTxId();
    journal = new ArrayList();
    queueIndex.setJournal(journal);
    try {
        for (int i = 0; i < keys.size(); i++) {
            addMessagePageReference(queueIndex.remove((QueueIndexEntry) keys.get(i)));
        }
    } catch (Exception e) {
        e.printStackTrace();
        throw new StoreException(e.getMessage());
    }
    keys.clear();
    super.commit();
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/commit...done.");
}
Also used : ArrayList(java.util.ArrayList) QueueIndexEntry(com.swiftmq.impl.store.standard.index.QueueIndexEntry) StoreException(com.swiftmq.swiftlet.store.StoreException) IOException(java.io.IOException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Example 19 with StoreException

use of com.swiftmq.swiftlet.store.StoreException in project swiftmq-ce by iitsoftware.

the class StoreReadTransactionImpl method prepare.

public void prepare(XidImpl globalTxId) throws StoreException {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/prepare, globalTxId=" + globalTxId);
    try {
        prepareLogRecord = new PrepareLogRecordImpl(PrepareLogRecordImpl.READ_TRANSACTION, queueName, globalTxId, keys);
        ctx.preparedLog.add(prepareLogRecord);
    } catch (IOException e) {
        throw new StoreException(e.getMessage());
    }
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/prepare, globalTxId=" + globalTxId + ", done");
}
Also used : PrepareLogRecordImpl(com.swiftmq.impl.store.standard.xa.PrepareLogRecordImpl) IOException(java.io.IOException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Example 20 with StoreException

use of com.swiftmq.swiftlet.store.StoreException in project swiftmq-ce by iitsoftware.

the class StoreWriteTransactionImpl method commit.

public void commit(XidImpl globalTxId) throws StoreException {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$store", toString() + "/commit, globalTxId: " + globalTxId);
    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() + "/commit, globalTxId: " + globalTxId + ", done");
}
Also used : IOException(java.io.IOException) StoreException(com.swiftmq.swiftlet.store.StoreException)

Aggregations

StoreException (com.swiftmq.swiftlet.store.StoreException)23 CommitLogRecord (com.swiftmq.impl.store.standard.log.CommitLogRecord)8 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)6 SwapAddress (com.swiftmq.impl.store.standard.swap.SwapAddress)4 QueueIndexEntry (com.swiftmq.impl.store.standard.index.QueueIndexEntry)3 AbortLogRecord (com.swiftmq.impl.store.standard.log.AbortLogRecord)3 AsyncCompletionCallback (com.swiftmq.tools.concurrent.AsyncCompletionCallback)3 MessagePageReference (com.swiftmq.impl.store.standard.index.MessagePageReference)2 PrepareLogRecordImpl (com.swiftmq.impl.store.standard.xa.PrepareLogRecordImpl)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 SwapFile (com.swiftmq.impl.store.standard.swap.SwapFile)1 DurableStoreEntry (com.swiftmq.swiftlet.store.DurableStoreEntry)1 StoreEntry (com.swiftmq.swiftlet.store.StoreEntry)1 Semaphore (com.swiftmq.tools.concurrent.Semaphore)1