public void clearAndCancelStagedActivations() { if (getStageActivationsGroup().isEmpty()) { return; } org.drools.core.util.LinkedList<ActivationGroupNode> list = getStageActivationsGroup().getList(); final EventSupport eventsupport = (EventSupport) this.workingMemory; for (ActivationGroupNode node = list.removeFirst(); node != null; node = list.removeFirst()) { AgendaItem item = (AgendaItem) node.getActivation(); // This must be set to false otherwise modify won't work properly item.setQueued(false); eventsupport .getAgendaEventSupport() .fireActivationCancelled(item, this.workingMemory, MatchCancelledCause.CLEAR); } }
public int unstageActivations() { if (!declarativeAgenda || getStageActivationsGroup().isEmpty()) { return 0; } org.drools.core.util.LinkedList<ActivationGroupNode> list = getStageActivationsGroup().getList(); int i = 0; for (ActivationGroupNode node = list.removeFirst(); node != null; node = list.removeFirst()) { AgendaItem item = (AgendaItem) node.getActivation(); item.setActivationGroupNode(null); addActivation(item, false); i++; } notifyHalt(); return i; }
/* * (non-Javadoc) * * @see org.kie.common.AgendaI#clearActivationGroup(org.kie.spi.ActivationGroup) */ public void clearAndCancelActivationGroup(final InternalActivationGroup activationGroup) { final EventSupport eventsupport = (EventSupport) this.workingMemory; activationGroup.setTriggeredForRecency(this.workingMemory.getFactHandleFactory().getRecency()); for (final Iterator it = activationGroup.iterator(); it.hasNext(); ) { final ActivationGroupNode node = (ActivationGroupNode) it.next(); final Activation activation = node.getActivation(); activation.setActivationGroupNode(null); if (activation.isQueued()) { activation.setQueued(false); activation.remove(); eventsupport .getAgendaEventSupport() .fireActivationCancelled(activation, this.workingMemory, MatchCancelledCause.CLEAR); } } activationGroup.reset(); }