-
Enhancement
-
Resolution: Unresolved
-
Major
-
None
-
7.61.0.Final
-
None
-
NEW
-
NEW
org.drools.core.spi.Accumulator instances are created within the KieBase, not within the KieSession. This means that multiple sessions from the same KieBase may be calling the accumulate(...) method on a shared accumulator from different threads. Therefore whatever initialization being performed needs to be thread-safe.
The logical place for such code would be the init(...) method of the Accumulator interface. Unfortunately, we need access to innerDeclarations to be able to perform the accumulation quickly, and it only becomes available when this accumulate(...) method is called. Therefore, initialization of our accumulator can only happen when the accumulate(...) method is called, and therefore the initialization needs to be properly synchronized. This is difficult to do correctly, and we currently have to resort to double-checked locking, which is generally not advised.
We propose that the init(...) method provides the innerDeclarations argument that accumulate(...) provides, so that the one-time initialization can be moved to the proper place in code.
- is triggered by
-
PLANNER-2557 Got java.lang.ClassCastException when using ConstraintCollectors.toList
- Resolved