use of com.swiftmq.swiftlet.store.StoreException 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");
}
use of com.swiftmq.swiftlet.store.StoreException in project swiftmq-ce by iitsoftware.
the class StoreWriteTransactionImpl 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.WRITE_TRANSACTION, queueName, globalTxId, keys);
ctx.preparedLog.add(prepareLogRecord);
ctx.recoveryManager.commit(new CommitLogRecord(txId, sem, journal, this, null));
sem.waitHere();
ctx.transactionManager.removeTxId(txId);
} catch (Exception e) {
throw new StoreException(e.getMessage());
}
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$store", toString() + "/prepare, globalTxId=" + globalTxId + ", done");
}
use of com.swiftmq.swiftlet.store.StoreException in project swiftmq-ce by iitsoftware.
the class CompositeStoreTransactionImpl method commitTransaction.
public void commitTransaction() throws StoreException {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$store", toString() + "/commitTransaction...");
if (closed)
throw new StoreException("Transaction is closed");
if (txId == -1)
txId = ctx.transactionManager.createTxId();
try {
List<MessagePageReference> messagePageRefs = processRemovedKeys();
if (journal != null && journal.size() > 0) {
ctx.recoveryManager.commit(new CommitLogRecord(txId, sem, journal, this, messagePageRefs));
sem.waitHere();
removeTxId();
} else
removeTxId();
close();
} catch (Exception e) {
throw new StoreException(e.toString());
}
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$store", toString() + "/commitTransaction...done.");
}
Aggregations