When working on large write operations, instances of TransactionContext may stay referenced by an instance of java.util.TaskQueue long after the task has been cancelled
In TransactionContext.prepare() the rollback task is scheduled :
timer.schedule(this, timeout * 1000, Integer.MAX_VALUE);
In java.util.Timer looking at TimerThread.mainLoop() since the period is set to Integer.MaxValue and recurrent tasks are in the queue, the task may stay in the queue a lot longer than expected. This can lead to OutOfMemory errors.
The org.apache.jackrabbit.util.Timer could be modified to add a method to schedule tasks without period.
Or a call to Timer.purge() could be made in org.apache.jackrabbit.util.Task.cancel()
What do you think?