Thebas opened a new pull request, #7176:
URL: https://github.com/apache/incubator-kie/pull/7176

   **Issue**:
   
   * https://github.com/apache/incubator-kie-issues/issues/2412
   
   Bug 1: delete never released facts inserted with insert(obj, true) 
(NamedEntryPoint.java)
   - I added a helper, removeDynamicPropertyChangeListener. It removes the 
listener when the type is dynamic or the handle is in dynamicFacts, which is 
the condition the issue suggested.
   - It is called from two places:
     - deleteStated, which replaces the old check that only looked at the type.
     - removeFromObjectStore, the path that expired events go through. Before 
this, expiry never removed the listener at all, so an expired event of a 
dynamic type leaked its listener the same way.
   - Logical (TMS) retraction doesn't need the change. Logical inserts go 
straight to the internal ep.insert(handle, …), past the point where listeners 
are added, so a logical fact never has one.
   
   Bug 2: class-level @PropertyChangeSupport was ignored (TypeDeclaration.java)
   - processTypeAnnotations now calls a new configurePropertyChangeSupport, 
which only ever sets the type to dynamic. It can't undo a DRL declare … 
@propertyChangeSupport, because the DRL path runs this same method afterwards.
   - This one change applies to all three createTypeDeclarationForBean callers: 
the compiler, the runtime KnowledgeBaseImpl, and the executable model.
   
   Tests (in PropertyChangeSupportTest). Each one checks that the bean's own 
listener count drops to 0:
   - testDeleteUnregistersFactInsertedAsDynamic: your reproducer, inserting 
with insert(x, true) from a rule and deleting from another, over 10 cycles.
   - testClassLevelAnnotationMakesTypeDynamic: a class with only the 
annotation, no DRL declare.
   - testExpiryUnregistersDynamicFact: an @Expires("1s") event, using a pseudo 
clock.
   
   Results
   - On main without the fix, all 3 new tests fail. With the fix they pass, 
along with the existing test in that class.
   - These also pass with the fix:
     - the full drools-base and drools-kiesession test suites
     - DrlSpecificFeaturesTest, Misc2Test, JittingTest, CepEspTest, 
StatefulSessionTest and TruthMaintenanceTest
     - PropertyListenerTest in test-suite
   - Checkstyle passes on the 3 modules I changed.


-- 
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]

Reply via email to