public void fireUntilHalt(final AgendaFilter agendaFilter) { unstageActivations(); this.halt.set( false ); while ( continueFiring( -1 ) ) { boolean fired = fireNextItem( agendaFilter ); fired = fired || !((AbstractWorkingMemory) this.workingMemory).getActionQueue().isEmpty(); this.workingMemory.executeQueuedActions(); if ( !fired ) { try { synchronized ( this.halt ) { if( !this.halt.get() ) this.halt.wait(); } } catch ( InterruptedException e ) { this.halt.set( true ); } } else { this.workingMemory.executeQueuedActions(); } } }
public int fireAllRules(AgendaFilter agendaFilter, int fireLimit) { unstageActivations(); this.halt.set( false ); int fireCount = 0; while ( continueFiring( fireLimit ) && fireNextItem( agendaFilter ) ) { fireCount++; fireLimit = updateFireLimit( fireLimit ); this.workingMemory.executeQueuedActions(); } if ( this.focusStack.size() == 1 && getMainAgendaGroup().isEmpty() ) { // the root MAIN agenda group is empty, reset active to false, so it can receive more activations. getMainAgendaGroup().setActive( false ); } return fireCount; }