}
private void recoverQueueEntries(TransactionLogRecoveryHandler recoveryHandler)
throws DatabaseException
{
QueueEntryRecoveryHandler qerh = recoveryHandler.begin(this);
ArrayList<QueueEntryKey> entries = new ArrayList<QueueEntryKey>();
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);