public void execute(JobContext ctx) { ExpireJobContext context = (ExpireJobContext) ctx; context.workingMemory.queueWorkingMemoryAction( context.expireAction ); }
public void execute(JobContext ctx) { BehaviorJobContext context = (BehaviorJobContext) ctx; context.workingMemory.queueWorkingMemoryAction( new BehaviorExpireWMAction( context.nodeId, context.behavior, context.memory, context.behaviorContext ) ); }
/** * Checks if this ruleflow group is active and should automatically deactivate. * If the queue is empty, it deactivates the group. */ public void deactivateIfEmpty() { if ( this.active && this.autoDeactivate && this.list.isEmpty() ) { // deactivate callback WorkingMemoryAction action = new DeactivateCallback( this ); this.workingMemory.queueWorkingMemoryAction( action ); } }
public void retractObject( InternalFactHandle handle, PropagationContext context, InternalWorkingMemory workingMemory ) { final PropagationQueueingNodeMemory memory = (PropagationQueueingNodeMemory) workingMemory.getNodeMemory( this ); memory.addAction( new RetractAction( handle, context ) ); // if not queued yet, we need to queue it up if ( memory.isQueued().compareAndSet( false, true ) ) { workingMemory.queueWorkingMemoryAction( this.action ); } }
/** * @see org.drools.reteoo.ObjectSink#assertObject(InternalFactHandle, org.drools.spi.PropagationContext, org.drools.common.InternalWorkingMemory) */ public void assertObject( InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory ) { final PropagationQueueingNodeMemory memory = (PropagationQueueingNodeMemory) workingMemory.getNodeMemory( this ); memory.addAction( new AssertAction( factHandle, context ) ); // if not queued yet, we need to queue it up if ( memory.isQueued().compareAndSet( false, true ) ) { workingMemory.queueWorkingMemoryAction( this.action ); } }
public void delete(LogicalDependency node, BeliefSet beliefSet, PropagationContext context) { beliefSet.remove( node.getJustifierEntry() ); WorkingMemoryAction action = new LogicalRetractCallback( tms, node, beliefSet, (InternalFactHandle) node.getJustified(), context, node.getJustifier() ); wm.queueWorkingMemoryAction( action ); }
true ) ) { workingMemory.queueWorkingMemoryAction( this.action );
workingMemory.queueWorkingMemoryAction( new BehaviorExpireWMAction( nodeId, stw, memory,
public void execute(InternalWorkingMemory workingMemory) { if ( this.factHandle.isValid() ) { EventFactHandle eventHandle = (EventFactHandle) factHandle; if ( eventHandle.hasPendingActions() ) { workingMemory.queueWorkingMemoryAction( this ); return; } // if the fact is still in the working memory (since it may have been previously retracted already final PropagationContext context = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(), PropagationContext.EXPIRATION, null, null, this.factHandle ); eventHandle.setExpired( true ); this.node.retractObject( factHandle, context, workingMemory ); context.evaluateActionQueue( workingMemory ); // if no activations for this expired event if ( eventHandle.getActivationsCount() == 0 ) { // remove it from the object store and clean up resources eventHandle.getEntryPoint().retract( factHandle ); } context.evaluateActionQueue( workingMemory ); } }
public void clearAndCancelAndCancel(final RuleFlowGroup ruleFlowGroup) { final EventSupport eventsupport = (EventSupport) this.workingMemory; for (ActivationNode node : ruleFlowGroup) { AgendaItem item = (AgendaItem) node.getActivation(); if (item != null) { item.setActivated(false); item.remove(); if (item.getActivationGroupNode() != null) { item.getActivationGroupNode().getActivationGroup().removeActivation(item); } } eventsupport.getAgendaEventSupport().fireActivationCancelled( item, this.workingMemory, ActivationCancelledCause.CLEAR ); } ruleFlowGroup.clear(); if ( ruleFlowGroup.isActive() && ruleFlowGroup.isAutoDeactivate() ) { // deactivate callback WorkingMemoryAction action = new DeactivateCallback( (InternalRuleFlowGroup) ruleFlowGroup ); this.workingMemory.queueWorkingMemoryAction( action ); } }
public InternalWorkingMemory newWorkingMemory() { this.ruleBase.readLock(); try { InternalWorkingMemory wm = new ReteooWorkingMemory( this.ruleBase.nextWorkingMemoryCounter(), this.ruleBase, this.sessionConf, EnvironmentFactory.newEnvironment(), this.workingMemoryEventSupport, this.agendaEventSupport); wm.setGlobalResolver( this.globalResolver ); final InternalFactHandle handle = wm.getFactHandleFactory().newFactHandle( InitialFactImpl.getInstance(), wm.getObjectTypeConfigurationRegistry().getObjectTypeConf( EntryPoint.DEFAULT, InitialFactImpl.getInstance() ), wm, wm); wm.queueWorkingMemoryAction( new WorkingMemoryReteAssertAction( handle, false, true, null, null ) ); return wm; } finally { this.ruleBase.readUnlock(); } }
this.workingMemory.queueWorkingMemoryAction( action );
workingMemory.queueWorkingMemoryAction( this.action );