There exists a race condition such that we may call start on an XAResource but never call end (or anything else) on it if the transaction times out whilst the resource enlistment is still in progress. This is a Bad Thing and may make resource managers unhappy.
TransactionManager tm = new TransactionManagerImple();
Transaction t = tm.getTransaction();
// XAResourceImpl has a start method with Thread.sleep longer than 5s
XAResource xaResource = new XAResourceImpl();
// reaper times out the tx, resource manager for XAResource
// may have received start but never receives end.
Fix notes: TransactionImple.enlistResource needs to lock out the reaper thread. At first glance an alternative fix is to put the resource into the transaction's internal data structure before calling start on it, but that would allow an 'end, begin' sequence of calls to be seen by the resource manager.
caution: ref support case i-t #171373 there may exist additional race conditions in the app server JCA so this change alone won't necessarily fix the problem.