[
http://jira.jboss.com/jira/browse/JBRULES-313?page=all ]
Edson Tirelli reassigned JBRULES-313:
-------------------------------------
Assignee: Edson Tirelli (was: Mark Proctor)
Add halt/run commands
---------------------
Key: JBRULES-313
URL:
http://jira.jboss.com/jira/browse/JBRULES-313
Project: JBoss Rules
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Environment: any
Reporter: Jacek Jarmulak
Assigned To: Edson Tirelli
Fix For: 4.0.0.MR4
I have made a small modification to WorkingMemory and AbstractWorkingMemory that allows
me to pause and the restart rule firing.
The change consists of adding a boolean isPaused flag (plus gettter and setter methods)
which is then inspected in the while loop of the fireAllRules method as follows
public synchronized void fireAllRules(final AgendaFilter agendaFilter) throws
FactException {
if ( !this.firing ) {
try {
this.firing = true;
while ( !this.isPaused() && this.agenda.fireNextItem(
agendaFilter ) ) {
;
}
} finally {
this.firing = false;
}
}
}
What is this good for?
It lets me stop rule firing from within some rule, e.g. when I want to execute an
external call.
The rule sets up the call and then calls setPaused(true) on WorkingMemory.
Once fireAllRules exits, an external process executes the call, possibly asserting some
facts into WorkingMemory
and then calls setPaused(false) and calls fireAllRules again.
Why not execute the call directly from the rule?
Because in my application the execution might take long time, and I want to have an
option to move the WorkingMemory out of RAM,
possibly moving it to another app server to continue firing after the externall call
processing has completed.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira