From d43f2d5d3b22248dafb9cf9e1c28d97552170561 Mon Sep 17 00:00:00 2001 From: mariofusco Date: Thu, 12 Dec 2024 09:42:10 +0100 Subject: [PATCH] wip --- .../drools/core/common/DefaultFactHandle.java | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java b/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java index 27d40527f9c..88a05d6e053 100644 --- a/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java +++ b/drools-core/src/main/java/org/drools/core/common/DefaultFactHandle.java @@ -657,7 +657,20 @@ public TupleImpl detachLeftTupleAfter(RuleBasePartitionId partitionId, ObjectTyp } if (detached != null) { - removeLeftTuple(detached); + if (firstLeftTuple == detached) { + firstLeftTuple = null; + lastLeftTuple = null; + } + + if (lastLeftTuple == detached) { + lastLeftTuple = null; + } + + if (detached.getHandlePrevious() != null) { + lastLeftTuple = detached.getHandlePrevious(); + detached.setHandlePrevious(null); + lastLeftTuple.setHandleNext(null); + } } return detached; } @@ -672,7 +685,20 @@ public TupleImpl detachRightTupleAfter(RuleBasePartitionId partitionId, ObjectTy } if (detached != null) { - removeRightTuple(detached); + if (firstRightTuple == detached) { + firstRightTuple = null; + lastRightTuple = null; + } + + if (lastRightTuple == detached) { + lastRightTuple = null; + } + + if (detached.getHandlePrevious() != null) { + lastRightTuple = detached.getHandlePrevious(); + detached.setHandlePrevious(null); + lastRightTuple.setHandleNext(null); + } } return detached; }