pibizza opened a new pull request, #6499:
URL: https://github.com/apache/incubator-kie-drools/pull/6499
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
(AI generated summary, human revised. Hopefully not too boring)
Summary
This PR restructures the Phreak evaluation architecture by making
RuleNetworkEvaluator (RNE) a per-session component and consolidating scattered
evaluation logic into a single, cohesive location.
Motivation
Previously, the Phreak evaluation logic was fragmented across multiple
static utility classes (SegmentPropagator, TupleEvaluationUtil) and the RNE
was accessed as a singleton. This made the code harder to understand, test, and
maintain. The architecture also created unnecessary coupling between components.
Key Changes
1. RuleNetworkEvaluator is now per-session (commit da0123bb4b)
- Converted RuleNetworkEvaluator from interface with static utilities to a
proper per-session service
- Created RuleNetworkEvaluatorImpl to hold the concrete implementation
- Each ReteEvaluator now owns its own RuleNetworkEvaluator instance
- Phreak node handlers (PhreakJoinNode, PhreakAccumulateNode, etc.) are
instantiated per-session and held by the RNE
2. Consolidated segment propagation logic (commit 213f89d4ec)
- Moved all code from SegmentPropagator into RuleNetworkEvaluatorImpl
- Peer processing methods (processPeers, processPeerInserts,
processPeerUpdates, processPeerDeletes) are now internal to RNE
- Deleted SegmentPropagator.java entirely
3. Absorbed tuple evaluation utilities (commit e9eec815aa)
- Moved forceFlushLeftTuple and related methods from TupleEvaluationUtil
into RNE
- Made outerEval private - it's now an internal implementation detail
- Deleted TupleEvaluationUtil.java
4. Extracted common Phreak operations (commit 35532a5903)
- Created PhreakNodeOperations to hold shared utility methods used across
multiple Phreak node types
- Reduces code duplication and provides a clear home for cross-cutting
node operations
5. Updated all Phreak nodes to use per-session RNE
- Modified all Phreak*Node classes to accept ReteEvaluator in their
constructors
- Updated PhreakNetworkNodeFactory to create per-session instances
- Updated metric instrumentation classes accordingly
Benefits
- Better encapsulation: Internal evaluation mechanics (like outerEval) are
now private
- Clearer architecture: All network evaluation logic lives in one place
(RNE)
- Improved testability: Per-session instances are easier to test and mock
- Reduced coupling: Eliminated circular dependencies between RNE and
utility classes
- Easier to extend: Future Phreak improvements have a clear home in the RNE
Files Changed
- Deleted: SegmentPropagator.java, TupleEvaluationUtil.java (logic moved
to RNE)
- Added: RuleNetworkEvaluatorImpl.java, PhreakNodeOperations.java
- Refactored: RuleNetworkEvaluator.java (interface-only now)
- Updated: All Phreak*Node classes, PhreakNetworkNodeFactory, and session
management classes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]