コード例 #1
0
ファイル: ReteAgenda.java プロジェクト: chearius/drools
 public void removeScheduleItem(final ScheduledAgendaItem item) {
   if (item.isEnqueued()) {
     this.scheduledActivations.remove(item);
     item.setEnqueued(false);
     Scheduler.removeAgendaItem(item, this);
   }
 }
コード例 #2
0
ファイル: ReteAgenda.java プロジェクト: chearius/drools
  public void clearAndCancel() {
    // Cancel all items and fire a Cancelled event for each Activation
    for (InternalAgendaGroup internalAgendaGroup : this.agendaGroups.values()) {
      clearAndCancelAgendaGroup(internalAgendaGroup);
    }

    final EventSupport eventsupport = (EventSupport) this.workingMemory;
    if (!this.scheduledActivations.isEmpty()) {
      for (ScheduledAgendaItem item = this.scheduledActivations.removeFirst();
          item != null;
          item = this.scheduledActivations.removeFirst()) {
        item.setEnqueued(false);
        Scheduler.removeAgendaItem(item, this);
        eventsupport
            .getAgendaEventSupport()
            .fireActivationCancelled(item, this.workingMemory, MatchCancelledCause.CLEAR);
      }
    }

    // cancel all staged activations
    clearAndCancelStagedActivations();

    // cancel all activation groups.
    for (InternalActivationGroup group : this.activationGroups.values()) {
      clearAndCancelActivationGroup(group);
    }
  }
コード例 #3
0
ファイル: ReteAgenda.java プロジェクト: chearius/drools
  public void clear() {
    // reset focus stack
    this.focusStack.clear();
    this.focusStack.add(getMainAgendaGroup());

    // reset scheduled activations
    if (!this.scheduledActivations.isEmpty()) {
      for (ScheduledAgendaItem item = this.scheduledActivations.removeFirst();
          item != null;
          item = this.scheduledActivations.removeFirst()) {
        item.setEnqueued(false);
        Scheduler.removeAgendaItem(item, this);
      }
    }

    // reset staged activations
    getStageActivationsGroup().clear();

    // reset all agenda groups
    for (InternalAgendaGroup group : this.agendaGroups.values()) {
      group.reset();
    }

    // reset all activation groups.
    for (InternalActivationGroup group : this.activationGroups.values()) {
      group.setTriggeredForRecency(this.workingMemory.getFactHandleFactory().getRecency());
      group.reset();
    }
  }
コード例 #4
0
ファイル: ReteAgenda.java プロジェクト: chearius/drools
 /**
  * Schedule an agenda item for delayed firing.
  *
  * @param item The item to schedule.
  */
 public void scheduleItem(final ScheduledAgendaItem item, final InternalWorkingMemory wm) {
   this.scheduledActivations.add(item);
   item.setEnqueued(true);
   if (item.getPropagationContext().getReaderContext() == null) {
     // this is not a serialization propagation, so schedule it
     // otherwise the timer will be correlated with this activation later during the
     // deserialization of timers
     Scheduler.scheduleAgendaItem(item, this, wm);
   }
 }