I have a situation that relies on knowing when the job completes.
Basically a singleton manager keeps track of a bunch of job and their schedules. Assuming B follows A, when A executes scheduler deleted B’s job and reschedules it to be closer in time to A.
The problem I ran into is notifying the manager when job finished
public class Action extends ScheduledEvent implements Job {
public Action() {
}
protected Action(String name, MomentInTime momentInTime, FireEventFrequency repeatFrequency) throws SchedulerException {
super(momentInTime, repeatFrequency);
}
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
// Do some work
EventScheduleManager.getInstance().eventComplete(this);
}
}
I realize why that happens is due to the reflection and that at time of scheduling this is reinitialized and is now known by the manager.
Is there a way around it? How would you notify a manager entity that job it scheduled has completed?
I ended up passing the job name back to the manager
And the manager itself maintained the
Map<String,ScheduledEvent>took it from there