File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/main/java/org/springframework/data/neo4j/core/mapping Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -872,22 +872,25 @@ private boolean alreadyMappedInPreviousRecord(@Nullable Long internalId) {
872872 }
873873 }
874874
875+ /**
876+ * This method has an intended side effect.
877+ * It increases the process count of relationships (mapped by their ids)
878+ * AND checks if it was already processed twice (INCOMING/OUTGOING).
879+ */
875880 private boolean hasProcessedRelationshipCompletely (Long relationshipId ) {
876881 try {
877882 write .lock ();
878- read .lock ();
879883
880- int amount = processedRelationships .computeIfAbsent (relationshipId , s -> 0 );
881- if (amount == 2 ) {
884+ int processedAmount = processedRelationships .computeIfAbsent (relationshipId , s -> 0 );
885+ if (processedAmount == 2 ) {
882886 return true ;
883887 }
884888
885- processedRelationships .put (relationshipId , amount + 1 );
889+ processedRelationships .put (relationshipId , processedAmount + 1 );
886890 return false ;
887891
888892 } finally {
889893 write .unlock ();
890- read .unlock ();
891894 }
892895 }
893896
You can’t perform that action at this time.
0 commit comments