Class ScheduledGoalManager

java.lang.Object
edu.tufts.hrilab.action.manager.ScheduledGoalManager

public class ScheduledGoalManager extends Object
  • Constructor Details

    • ScheduledGoalManager

      public ScheduledGoalManager(ExecutionManager executionManager)
  • Method Details

    • executeScheduledGoal

      public void executeScheduledGoal(ScheduledGoal goal)
      Submit a new job for the schedule to handle execution of the scheduled goal. Also, add the ScheduledGoal to the scheduledGoals map.
      Parameters:
      goal - ScheduledGoal to execute
    • getNextScheduledExecutionDate

      public Date getNextScheduledExecutionDate(long goalId)
      Get Date of next scheduled goal execution. Returns null if goalId is for a non-scheduled goal, or if scheduled goal will not execute again.
      Parameters:
      goalId - scheduled goal ID
      Returns:
      Date or null
    • joinOnScheduledGoal

      public void joinOnScheduledGoal(long gid)
      Wait for the matching scheduled goal to terminate. Returns immediately if the goal is not found or is not a scheduled goal.
    • joinOnScheduledGoal

      public void joinOnScheduledGoal(long gid, long millis)
      Wait (up to specified milliseconds) for the matching scheduled goal to terminate. Returns immediately if the goal is not found or is not a scheduled goal.
    • getScheduledGoal

      public ScheduledGoal getScheduledGoal(long goalId)
      Get ScheduledGoal with goal ID, or null.
      Parameters:
      goalId -
      Returns:
    • getScheduledGoals

      public List<ScheduledGoal> getScheduledGoals()
      Get a copied list of all scheduled goals which have either yet to be submitted, or are currently executing.
      Returns:
      shallow copy of scheduled goals
    • getScheduledGoals

      public List<ScheduledGoal> getScheduledGoals(Symbol actor)
      Get a copied list of all scheduled goals which have either yet to be submitted, or are currently executing.
      Returns:
      shallow copy of scheduled goals
    • updateScheduledGoal

      public boolean updateScheduledGoal(long goalId, Predicate update)
      Modify existing scheduled goal based on update predicate.
      Parameters:
      goalId - ID of scheduled goal
      update - update predicate
      Returns:
      if update was successful
    • cancelScheduledGoal

      public boolean cancelScheduledGoal(ScheduledGoal goal)
      Cancel ScheduledGoal. This also cancels any active goals that are executing as part of this scheduled goal.
      Parameters:
      goal -
      Returns:
    • cancelScheduledGoals

      public void cancelScheduledGoals()
      Cancel all scheduled goals.
    • removeGoal

      public boolean removeGoal(ScheduledGoal goal)
      Remove a ScheduledGoal from the local container. This does not initiate canceling, and is purely for bookkeeping purposes.
      Parameters:
      goal -
      Returns:
    • setScheduledGoalsFile

      public void setScheduledGoalsFile(String filepath)
    • setGoalManagerNotifier

      public void setGoalManagerNotifier(GoalManagerNotifier notifier)
    • writeScheduledGoalsToFile

      public void writeScheduledGoalsToFile()
    • shutdown

      public void shutdown()