Package edu.tufts.hrilab.action.manager
Class ScheduledGoalManager
java.lang.Object
edu.tufts.hrilab.action.manager.ScheduledGoalManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCancel ScheduledGoal.voidCancel all scheduled goals.voidSubmit a new job for the schedule to handle execution of the scheduled goal.getNextScheduledExecutionDate(long goalId) Get Date of next scheduled goal execution.getScheduledGoal(long goalId) Get ScheduledGoal with goal ID, or null.Get a copied list of all scheduled goals which have either yet to be submitted, or are currently executing.getScheduledGoals(Symbol actor) Get a copied list of all scheduled goals which have either yet to be submitted, or are currently executing.voidjoinOnScheduledGoal(long gid) Wait for the matching scheduled goal to terminate.voidjoinOnScheduledGoal(long gid, long millis) Wait (up to specified milliseconds) for the matching scheduled goal to terminate.booleanremoveGoal(ScheduledGoal goal) Remove a ScheduledGoal from the local container.voidsetGoalManagerNotifier(GoalManagerNotifier notifier) voidsetScheduledGoalsFile(String filepath) voidshutdown()booleanupdateScheduledGoal(long goalId, Predicate update) Modify existing scheduled goal based on update predicate.void
-
Constructor Details
-
ScheduledGoalManager
-
-
Method Details
-
executeScheduledGoal
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
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
Get ScheduledGoal with goal ID, or null.- Parameters:
goalId-- Returns:
-
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
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
Modify existing scheduled goal based on update predicate.- Parameters:
goalId- ID of scheduled goalupdate- update predicate- Returns:
- if update was successful
-
cancelScheduledGoal
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
Remove a ScheduledGoal from the local container. This does not initiate canceling, and is purely for bookkeeping purposes.- Parameters:
goal-- Returns:
-
setScheduledGoalsFile
-
setGoalManagerNotifier
-
writeScheduledGoalsToFile
public void writeScheduledGoalsToFile() -
shutdown
public void shutdown()
-