Optimize TransactionSynchronizationManager.getSynchronizations() to avoid sorting and ArrayList creation in case of a single TransactionSynchronization.

Comment From: marschall

Spring Batch registers a single TransactionSynchronization in TaskletStep#doExecute(StepExecution). In certain extreme cases the ArrayList and Object[] creation can become noticeable. This PR optimizes the case of a single TransactionSynchronization, avoids the sorting and instead calls Collections#singletonList(Object).

Before:

TransactionSynchronizationManager_getSynchronizations

After:

after-patch

Comment From: marschall

Thank you for merging