I am currently using drools in a project and I am finding that my heap is
accumulating (and seemingly not releasing) several ConsequenceInvoker
classes. I have done a search on possible causes but have not found much
regarding this issue. Below is an excerpt of the code that runs the rules
engine. I have checked that the code deregisters the execution set and
closes the rulesession, is there anything else that it needs to do to
release resources?
Thanks,
Todd
try
{
RuleExecutionSet rexeSet = null;
StatelessRuleSession ruleSession = null;
rexeSet = _localRuleExeSetProvider.createRuleExecutionSet(strReader,
properties);
uidName = new UID();//use a unique name for this rule set each time
through
_ruleAdmin.registerRuleExecutionSet(uidName.toString(), rexeSet,
null);
ruleSession =
(StatelessRuleSession)_ruleRunTime.createRuleSession(uidName.toString(),
null, RuleRuntime.STATELESS_SESSION_TYPE);
//execute the rules and facts
listRetDrools = (List)ruleSession.executeRules(listFacts);
}
catch(Exception e){
_log.fatal("Rule Engine execution error!", e);
throw new
RuleEngineException(RuleEngineErrorType.RULEENGINE_EXECUTION_ERROR, e);
}
finally {
//release the rule session
if (ruleSession != null) {
try {
ruleSession.release();
_log.info("Released the rule session.");
}
catch(Exception e) {
_log.fatal("Rule Engine execution cleanup error!", e);
throw new
RuleEngineException(RuleEngineErrorType.RULEENGINE_EXECUTION_CLEANUP_ERROR,
e);
}
}
else
_log.info("No rule session to release.");
//deregister the execution set
if (rexeSet != null && uidName != null) {
try {
_ruleAdmin.deregisterRuleExecutionSet(uidName.toString(), null);
}
catch(Exception e)
{
_log.fatal("Rule Execution Set deregistration error!", e);
throw new
RuleEngineException(RuleEngineErrorType.RULEENGINE_EXECUTION_CLEANUP_ERROR,
e);
}
}
else
_log.info("No rule execution set to deregister.");
//close our rule reader
if (strReader != null){
strReader.close();
_log.info("Closed the rule stream.");
}
//close our dsl reader...
if (strDSLReader != null) {
strDSLReader.close();
_log.info("Closed the DSL stream.");
}
}
--
View this message in context:
http://www.nabble.com/ConsequenceInvokers-building-up-in-heap-tp22927995p...
Sent from the drools - user mailing list archive at
Nabble.com.