Blog Scheduler approach 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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