use of com.swiftmq.impl.store.standard.log.CommitLogRecord 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.");
}
use of com.swiftmq.impl.store.standard.log.CommitLogRecord in project swiftmq-ce by iitsoftware.
the class PreparedLogQueue method remove.
public synchronized void remove(PrepareLogRecordImpl logRecord) throws IOException {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$store", toString() + "/remove, logRecord: " + logRecord);
int address = (int) logRecord.getAddress();
CacheEntry cacheEntry = (CacheEntry) cache.get(address);
if (cacheEntry == null)
throw new EOFException("No CacheEntry found at index: " + address);
cache.set(address, null);
long txId = ctx.transactionManager.createTxId(false);
List journal = new ArrayList();
queueIndex.setJournal(journal);
Semaphore sem = new Semaphore();
try {
queueIndex.remove(cacheEntry.indexEntry);
ctx.recoveryManager.commit(new CommitLogRecord(txId, sem, journal, this, null));
} catch (Exception e) {
throw new IOException(e.toString());
}
sem.waitHere();
ctx.transactionManager.removeTxId(txId);
}
Aggregations