It's probably because dispose unregisters from various listeners and clears up some
housekeeping resources, timers etc. It's possible your rules are simple enough
that they don't need any of this and so not calling the listeners saves a significant
amount of time - particularly if your test case is overly trivial .
Whether it keeps working in any future versions I wouldn't want to guarantee you,
dispose may start nulling out fields etc that would break future calls to the methods.
Thomas
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-
bounces(a)lists.jboss.org] On Behalf Of tonytang
Sent: 21 October 2011 11:29
To: rules-users(a)lists.jboss.org
Subject: Re: [rules-users] StatefulKnowledgeSession.dispose()
But how to explain if I call dispose() in the loop the performance improve 10
times?
I already call the retract after every fireAllRules
I know we should not call dispose when we still need to use it.
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received
this message in error, please immediately notify the postmaster(a)nds.com and delete it from
your system as well as any copies. The content of e-mails as well as traffic data may be
monitored by NDS for employment and security purposes. To protect the environment please
do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United
Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603
8808 40-00
**************************************************************************************