Transactions may take longer than intended and eventually timeout, whereupon they are rolled back by the reaper.
JBTM-2476 helpfully prints the stack traces for threads active in the tx at the point of the timeout, which can show e.g. db driver connections waiting for sql results.
However, that does not show when the current operations began and in some cases they may be short running operations that execute after a longer one that is not visible in the logs. Therefore for diagnostic purposes it is desirable to capture the transaction state at intervals throughout its lifetime, such that long operations appear in several samples and can be distinguished from short ones.
The reaper's timed wakeup mechanism can be adapted for this use case, such that stacktraces can be taken at configurable interval over the timeline of the tx, then dumped in batch to the logs if the tx eventually times out. This enhanced diagnostic information should make identifying the cause of slow transactions easier.