This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/master by this push:
     new 65de49d  CAY-2713 ConcurrentModificationException when Inserting
65de49d is described below

commit 65de49d46e97be837dd4d10d7526bf502fb6f961
Author: Nikita Timofeev <stari...@gmail.com>
AuthorDate: Mon Jun 21 11:49:12 2021 +0300

    CAY-2713 ConcurrentModificationException when Inserting
---
 RELEASE-NOTES.txt                                                    | 1 +
 .../apache/cayenne/access/flush/DefaultDataDomainFlushAction.java    | 2 +-
 .../org/apache/cayenne/access/flush/operation/DbRowOpMerger.java     | 5 -----
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 52f65a9..9d353a2 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -27,6 +27,7 @@ CAY-2708 Gradle build plugin fails on Java 16
 CAY-2709 Modeler: Cgen fails to generate code for a new unsaved project with 
all settings set to default
 CAY-2710 Modeler: modeler throws IllegalArgumentsException when root and rel 
paths have different root
 CAY-2712 Shouldn't run batch inserts with generated keys if there is reflexive 
dependency
+CAY-2713 ConcurrentModificationException when Inserting
 
 ----------------------------------
 Release: 4.2.M3
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/flush/DefaultDataDomainFlushAction.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/flush/DefaultDataDomainFlushAction.java
index c42f819..5a673f2 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/flush/DefaultDataDomainFlushAction.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/flush/DefaultDataDomainFlushAction.java
@@ -130,7 +130,7 @@ public class DefaultDataDomainFlushAction implements 
DataDomainFlushAction {
     protected List<DbRowOp> mergeSameObjectIds(List<DbRowOp> dbRowOps) {
         Map<ObjectId, DbRowOp> index = new HashMap<>(dbRowOps.size());
         // new EffectiveOpId()
-        dbRowOps.forEach(row -> index.merge(row.getChangeId(), row, 
DbRowOpMerger.INSTANCE));
+        dbRowOps.forEach(row -> index.merge(row.getChangeId(), row, new 
DbRowOpMerger()));
         // reuse list
         dbRowOps.clear();
         dbRowOps.addAll(index.values());
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/flush/operation/DbRowOpMerger.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/flush/operation/DbRowOpMerger.java
index d17eb8a..7a7dedf 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/flush/operation/DbRowOpMerger.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/flush/operation/DbRowOpMerger.java
@@ -28,13 +28,8 @@ import java.util.function.BiFunction;
  */
 public class DbRowOpMerger implements DbRowOpVisitor<DbRowOp>, 
BiFunction<DbRowOp, DbRowOp, DbRowOp> {
 
-    public static final DbRowOpMerger INSTANCE = new DbRowOpMerger();
-
     private DbRowOp dbRow;
 
-    DbRowOpMerger() {
-    }
-
     @Override
     public DbRowOp apply(DbRowOp oldValue, DbRowOp newValue) {
         this.dbRow = oldValue;

Reply via email to