Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Blog Scheduler approach 2
@Override
void run()
{
while(true)
{
newJob = getNewJobFromCrontabFile() // blocking call
jobQueue.push(newJob)
if(newJob == jobQueue.peek())
{
// The new job is the one that will be scheduled next.
// So wakeup consumer thread so that it does not oversleep.
jobQueueConsumerThread.interrupt()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment