[rules-users] Heap and scheduled Activations

cyberdav at free.fr cyberdav at free.fr
Wed Jan 16 08:08:13 EST 2008


Hi everyone,

I've wrote that rule:

rule "COMPTEUR"
duration 10000
when
	$alarme : Alarm ();
then
	$alarme.increment();
	update($alarme);
end

Using JProfile, I've noticed that PropagationContextImpl was constantly growing
in the heap. Then, I looked the scheduled activations and saw that some
scheduledExecutionTime was expired. So, I wrote this code to purge the expired
activations:

Activation[] activations = session.getAgenda().getScheduledActivations();
long now = (new Date()).getTime();
for(int i=0;i<activations.length;i++){
	if( now >
((org.drools.common.ScheduledAgendaItem)activations[i]).scheduledExecutionTime()){
		activations[i].remove();
	}
}

Now, the heap isn't growing anymore but what are the consequences of doing
something like that? So far, there are no noticeable regression on my
application.

Thanks for your help.
Dav.



More information about the rules-users mailing list