Ok, so I have two schedules as below. You can see that I have my executor service as well as a new instance of scheduler.
Seeing as I have a single instance of scheduler, and I have two tasks I want to run at different times. Does this mean that in the below configuration I'm merely rescheduling the existing instance of scheduler?
Do I need to have multiple scheduler instances?
Instantiate executor service and scheduler
//Creates Executor Instance
final ExecutorService es = Executors.newSingleThreadExecutor();
// Creates a Scheduler instance.
Scheduler scheduler = new Scheduler();
Create schedule for first recurring task
// Schedule a once-a-week task at midday on Sunday.
scheduler.schedule("* 12 * * 7", new Runnable() {
public void run() {
Log.i(CLASS_NAME, "ConstituentScraper Schedule");
es.submit(new ConstituentScraper());
}
});
Create schedule for second recurring task
// Schedule a once-a-day task.
scheduler.schedule("* 7 * * 1-5 | * 18 * * 1-5 ", new Runnable() {
public void run() {
Log.i(CLASS_NAME, "SummaryScraper Schedule");
es.submit(new SummaryScraper());
}
});