apache / incubator-kie-drools

Drools is a rule engine, DMN engine and complex event processing (CEP) engine for Java.
http://www.drools.org
Apache License 2.0
5.88k stars 2.5k forks source link

[kie-issues#1153] Dispose session in tests. #5888

Closed baldimir closed 6 months ago

baldimir commented 6 months ago

Fixes: https://github.com/apache/incubator-kie-issues/issues/1153

Kie Session needs to be disposed in tests to avoid memory leaks.

baldimir commented 6 months ago

That's ok, but I wonder if it makes sense to make the KieSession to also implement Autocloseable and maybe implement the close() method just like an alias for the dispose() one. I did something similar for the RuleUnitInstance and this allows you to use try-with-resource like this. WDYT?

Yes, that sounds fine. However I think it would be better done in a separate PR. I will take a look.

baldimir commented 6 months ago

Here is another PR with the AutoCloseable functionality https://github.com/apache/incubator-kie-drools/pull/5890.

baldimir commented 6 months ago

Jenkins PR check failed on kogito-examples on some Jenkins environment issue. It is unrelated to these changes. So I think this can be merged.