Ejemplo n.º 1
0
 public void removeScheduleItem(final ScheduledAgendaItem item) {
   if (item.isEnqueued()) {
     this.scheduledActivations.remove(item);
     item.setEnqueued(false);
     Scheduler.removeAgendaItem(item, this);
   }
 }
Ejemplo n.º 2
0
  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);
    }
  }
Ejemplo n.º 3
0
  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();
    }
  }
Ejemplo n.º 4
0
 /**
  * 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);
   }
 }