Skip to content

Commit

Permalink
all tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
mdproctor committed Aug 8, 2024
1 parent 2b37276 commit cd45eba
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.drools.core.reteoo.PathEndNode.PathMemSpec;
import org.drools.core.reteoo.PathMemory;
import org.drools.core.reteoo.QueryElementNode;
import org.drools.core.reteoo.RightInputAdapterNode;
import org.drools.core.reteoo.TupleToObjectNode;
import org.drools.core.reteoo.RightTuple;
import org.drools.core.reteoo.RuntimeComponentFactory;
Expand Down Expand Up @@ -1225,10 +1226,11 @@ private static void insertPeerRightTuple(TupleImpl lt, InternalWorkingMemory wm,
prevLt = lt;
lt = lt.getPeer();
} else if (insert) {
BetaMemory bm = (BetaMemory) wm.getNodeMemories().peekNodeMemory(sink);
BetaNode betaNode = ((RightInputAdapterNode)sink).getBetaNode();
BetaMemory bm = (BetaMemory) wm.getNodeMemories().peekNodeMemory(betaNode);
if (bm != null) {
prevLt = TupleFactory.createPeer(tton, prevLt);
bm.linkNode((BetaNode) sink, wm);
bm.linkNode(betaNode, wm);
bm.getStagedRightTuples().addInsert(prevLt);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public TupleSets evalNode(PathMemory pmem, NetworkNode node, long bit, Memory no
break;
}
case NodeTypeEnums.SequenceNode: {
pSequenceNode.doNode((SequenceNode) node, (SequenceNodeMemory) nodeMem, pmem, smem, sink, activationsManager, srcTuples, trgTuples, stagedLeftTuples);
pSequenceNode.doNode((SequenceNode) node, (SequenceNodeMemory) nodeMem, sink, activationsManager.getReteEvaluator(), srcTuples, trgTuples, stagedLeftTuples);
break;
}
case NodeTypeEnums.ConditionalBranchNode: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.drools.base.common.RuleBasePartitionId;
import org.drools.base.reteoo.NodeTypeEnums;
import org.drools.core.RuleBaseConfiguration;
import org.drools.core.common.ActivationsManager;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.common.InternalWorkingMemory;
import org.drools.core.common.Memory;
Expand Down Expand Up @@ -464,9 +463,9 @@ public void doNode(SequenceNode node,

private void doLeftUpdates(SequenceNode node, TupleSets srcLeftTuples, TupleSets trgLeftTuples, TupleSets stagedLeftTuples, ReteEvaluator reteEvaluator) {}

public void doNode(SequenceNode node, SequenceNodeMemory nodeMem, PathMemory pmem, SegmentMemory smem, LeftTupleSinkNode sink, ActivationsManager activationsManager, TupleSets srcTuples, TupleSets trgTuples, TupleSets stagedLeftTuples) {

}
// public void doNode(SequenceNode node, SequenceNodeMemory nodeMem, PathMemory pmem, SegmentMemory smem, LeftTupleSinkNode sink, ActivationsManager activationsManager, TupleSets srcTuples, TupleSets trgTuples, TupleSets stagedLeftTuples) {
//
// }

private void doLeftDeletes(SequenceNode node,
TupleSets srcLeftTuples, TupleSets trgLeftTuples, TupleSets stagedLeftTuples,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ public PhreakTimerNode createPhreakTimerNode() {

public PhreakSequenceNode createPhreakSequenceNode() {
if (MetricLogUtils.getInstance().isEnabled()) {
//return new PhreakSequenceNodeMetric();
throw new UnsupportedOperationException();
return new PhreakSequenceNodeMetric();
} else {
return new PhreakSequenceNode();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.drools.metric.phreak;

import org.drools.core.common.ReteEvaluator;
import org.drools.core.common.TupleSets;
import org.drools.core.reteoo.AsyncSendNode;
import org.drools.core.reteoo.AsyncSendNode.AsyncSendMemory;
import org.drools.core.reteoo.LeftTupleSink;
import org.drools.core.reteoo.SequenceNode;
import org.drools.core.reteoo.SequenceNode.PhreakSequenceNode;
import org.drools.core.reteoo.SequenceNode.SequenceNodeMemory;
import org.drools.metric.util.MetricLogUtils;

public class PhreakSequenceNodeMetric extends PhreakSequenceNode {
@Override
public void doNode(SequenceNode node,
SequenceNodeMemory memory,
LeftTupleSink sink,
ReteEvaluator reteEvaluator,
TupleSets srcLeftTuples,
TupleSets trgLeftTuples,
TupleSets stagedLeftTuples) {

try {
MetricLogUtils.getInstance().startMetrics(node);

super.doNode(node, memory,
sink, reteEvaluator,
srcLeftTuples, trgLeftTuples, stagedLeftTuples);

} finally {
MetricLogUtils.getInstance().logAndEndMetrics();
}
}
}

0 comments on commit cd45eba

Please sign in to comment.