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; }