use of org.apache.qpid.server.store.berkeleydb.entry.PreparedTransaction in project qpid-broker-j by apache.
the class PreparedTransactionBinding method entryToObject.
public static PreparedTransaction entryToObject(final CachingUUIDFactory uuidFactory, final DatabaseEntry value) {
TupleInput input = TupleBinding.entryToInput(value);
Transaction.EnqueueRecord[] enqueues = readEnqueueRecords(uuidFactory, input);
Transaction.DequeueRecord[] dequeues = readDequeueRecords(uuidFactory, input);
return new PreparedTransaction(enqueues, dequeues);
}
use of org.apache.qpid.server.store.berkeleydb.entry.PreparedTransaction in project qpid-broker-j by apache.
the class AbstractBDBMessageStore method recordXid.
private List<Runnable> recordXid(Transaction txn, long format, byte[] globalId, byte[] branchId, org.apache.qpid.server.store.Transaction.EnqueueRecord[] enqueues, org.apache.qpid.server.store.Transaction.DequeueRecord[] dequeues) throws StoreException {
DatabaseEntry key = new DatabaseEntry();
Xid xid = new Xid(format, globalId, branchId);
XidBinding keyBinding = XidBinding.getInstance();
keyBinding.objectToEntry(xid, key);
DatabaseEntry value = new DatabaseEntry();
PreparedTransaction preparedTransaction = new PreparedTransaction(enqueues, dequeues);
PreparedTransactionBinding.objectToEntry(preparedTransaction, value);
for (org.apache.qpid.server.store.Transaction.EnqueueRecord enqueue : enqueues) {
StoredMessage storedMessage = enqueue.getMessage().getStoredMessage();
if (storedMessage instanceof StoredBDBMessage) {
((StoredBDBMessage) storedMessage).store(txn);
}
}
try {
getXidDb().put(txn, key, value);
return Collections.emptyList();
} catch (RuntimeException e) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Failed to write xid: {}", e.getMessage(), e);
}
throw getEnvironmentFacade().handleDatabaseException("Error writing xid to database", e);
}
}
Aggregations