OW2 Consortium jasmine

Compare Revisions

Ignore whitespace Rev 7293 → Rev 7294

/jasmine-selfmanagement/trunk/jasmine-selfmanagement/Drools_for_JOnAS/modules/api/src/main/java/org/ow2/jasmine/rules/AbstractDroolsWorkingMemory.java
189,7 → 189,7
* @return the corresponding FactHandle
*/
public FactHandle insert(final Object fact) {
if (state != STOPPED && knowledgeSession != null) {
if (isReady()) {
synchronized (monitor) {
debug("WorkingMemory[<name>] Inserting fact into session.");
return knowledgeSession.insert(fact);
206,7 → 206,7
* @param object the new value
*/
public void update(FactHandle handle, Object object) {
if (state != STOPPED && knowledgeSession != null) {
if (isReady()) {
synchronized (monitor) {
debug("WorkingMemory[<name>] Updating fact into session.");
knowledgeSession.update(handle, object);
216,6 → 216,13
}
}
 
/**
* @return {@code true} if the KnowledgeSession is ready to be used.
*/
private boolean isReady() {
return (state != STOPPED) && (knowledgeSession != null);
}
 
// ------------------------------------------------------------------------
// Protected methods
// ------------------------------------------------------------------------
251,7 → 258,7
* Execute the rules after the timeout
*/
public void run() {
while (state != STOPPED && knowledgeSession != null) {
while (isReady()) {
synchronized (monitor) {
try {
int fired = knowledgeSession.fireAllRules();