servicemix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gert Vanthienen (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (SM-1524) Fix for Memory Leak in ServiceMix-Drools4 DroolsEndpoint
Date Tue, 02 Sep 2008 07:35:52 GMT

     [ https://issues.apache.org/activemq/browse/SM-1524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gert Vanthienen resolved SM-1524.
---------------------------------

    Resolution: Fixed

> Fix for Memory Leak in ServiceMix-Drools4 DroolsEndpoint
> --------------------------------------------------------
>
>                 Key: SM-1524
>                 URL: https://issues.apache.org/activemq/browse/SM-1524
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-drools
>    Affects Versions: 3.2.1
>            Reporter: Roman Stumm
>            Assignee: Gert Vanthienen
>             Fix For: 3.3
>
>
> There is a memory leak in class org.apache.servicemix.drools.DroolsEndpoint, because
the StatefulSession object must be released, otherwise the drools rulebase keeps a reference
to it. 
> (Description see drools docu: 
> http://downloads.jboss.com/drools/docs/4.0.7.19894.GA/html_single/index.html#d0e900
> Chapter 2.5.5
> The StatefulSession extends the WorkingMemory class. It simply adds async methods and
a dispose() method. The ruleBase retains a reference to each StatefulSession is creates, so
that it can update them when new rules are added, dispose() is needed to release the StatefulSession
reference from the RuleBase, without it you can get memory leaks.
> )
> Here is the fix: (replace methods drools() and createWorkingMemory() with those in  org.apache.servicemix.drools.DroolsEndpoint)
>   protected void drools(MessageExchange exchange) throws Exception {
>         StatefulSession memory = createWorkingMemory(exchange);
>         try {
>             populateWorkingMemory(memory, exchange);
>             memory.fireAllRules();
>         } finally {
>             memory.dispose();
>         }
>     }
>     
>     protected StatefulSession createWorkingMemory(MessageExchange exchange) throws Exception
{
>         return ruleBase.newStatefulSession();
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message