Status: Open (View Workflow)
Affects Version/s: 5.5.0.Final
Fix Version/s: None
Component/s: drools-core (expert)
I am using a stateless session. First I add an agenda event listener. When I first call session.execute(Itelable) all works as expected. However when I call it the second time (without adding the listener again) the listener does not seem to be called at all.
However note that when I call session.getAgendaEventListeners() the event listener is always there.
IMHO I am guessing that the 'dispose' method that is called behind the scenes possibly dis-associates the event listener.
I've tested this with 5.5.Final. BTW This worked fine with Drools 5.0. I haven't checked later versions.
I wonder is this a bug or a feature?
Isolated test case is attached.
I had a look at the source code of StatelessKnowledgeSessionImpl.java (from
It seems that when execute(..) is being called for the first time, the event listeners are being added to this.agendaEventSupport, see line number 136. However when the dispose() method is being called internally by Drools this agendaEventSupport collection is cleared. Then upon further executions (calls to the execute(..) method) the event listeners are no longer added to this.agendaEventSupport and hence they are not being triggered