Merge pull request #27335 from marschall

* pr/27335:
  Optimize for single TransactionSynchronization

Closes gh-27335
This commit is contained in:
Stephane Nicoll 2023-08-26 09:56:47 +02:00
commit 16cb296b35
1 changed files with 3 additions and 0 deletions

View File

@ -297,6 +297,9 @@ public abstract class TransactionSynchronizationManager {
if (synchs.isEmpty()) {
return Collections.emptyList();
}
else if (synchs.size() == 1) {
return Collections.singletonList(synchs.iterator().next());
}
else {
// Sort lazily here, not in registerSynchronization.
List<TransactionSynchronization> sortedSynchs = new ArrayList<>(synchs);