Cursor cursor = null;
try
{
cursor = _deliveryDb.openCursor(null, null);
DatabaseEntry key = new DatabaseEntry();
QueueEntryBinding keyBinding = QueueEntryBinding.getInstance();
DatabaseEntry value = new DatabaseEntry();
while (cursor.getNext(key, value, LockMode.RMW) == OperationStatus.SUCCESS)
{
QueueEntryKey qek = keyBinding.entryToObject(key);
entries.add(qek);
}
try
{
cursor.close();
}
finally
{
cursor = null;
}
for(QueueEntryKey entry : entries)
{
UUID queueId = entry.getQueueId();
long messageId = entry.getMessageId();
qerh.queueEntry(queueId, messageId);
}
}
catch (DatabaseException e)
{
LOGGER.error("Database Error: " + e.getMessage(), e);
throw e;
}
finally
{
closeCursorSafely(cursor);
}
TransactionLogRecoveryHandler.DtxRecordRecoveryHandler dtxrh = qerh.completeQueueEntryRecovery();
cursor = null;
try
{
cursor = _xidDb.openCursor(null, null);
DatabaseEntry key = new DatabaseEntry();
XidBinding keyBinding = XidBinding.getInstance();
PreparedTransactionBinding valueBinding = new PreparedTransactionBinding();
DatabaseEntry value = new DatabaseEntry();
while (cursor.getNext(key, value, LockMode.RMW) == OperationStatus.SUCCESS)
{
Xid xid = keyBinding.entryToObject(key);
PreparedTransaction preparedTransaction = valueBinding.entryToObject(value);
dtxrh.dtxRecord(xid.getFormat(),xid.getGlobalId(),xid.getBranchId(),
preparedTransaction.getEnqueues(),preparedTransaction.getDequeues());
}