RuntimeException exc = null;
for (ListIterator<WriteCommand> i = copy.listIterator(copy.size()); i.hasPrevious();)
{
WriteCommand undoOp = i.previous();
// since we are using pessimistic locking, all pessimistic WriteCommands implement ReversibleCommand.
ReversibleCommand txCommand = (ReversibleCommand) undoOp;
if (log.isDebugEnabled()) log.debug("Calling rollback() on command " + undoOp);
try
{
txCommand.rollback();
}
catch (RuntimeException re)
{
exc = re;
}