From c3e43ecd117dc9ec5471201c8c79bcfed3ca026a Mon Sep 17 00:00:00 2001 From: Nathan Xu Date: Tue, 6 Oct 2020 10:28:58 -0400 Subject: [PATCH] HHH-14248 Refactor latestBatches from InsertActionSorter's field to temporary variable in its sort method --- .../main/java/org/hibernate/engine/spi/ActionQueue.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java index 89759e5515..425bdc4e92 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java @@ -1129,9 +1129,6 @@ public class ActionQueue { } } - // the mapping of entity names to their latest batch numbers. - private List latestBatches; - // the map of batch numbers to EntityInsertAction lists private Map> actionBatches; @@ -1143,9 +1140,11 @@ public class ActionQueue { */ public void sort(List insertions) { // optimize the hash size to eliminate a rehash. - this.latestBatches = new ArrayList<>( ); this.actionBatches = new HashMap<>(); + // the mapping of entity names to their latest batch numbers. + final List latestBatches = new ArrayList<>(); + for ( AbstractEntityInsertAction action : insertions ) { BatchIdentifier batchIdentifier = new BatchIdentifier( action.getEntityName(),