Last active
May 30, 2020 15:35
-
-
Save Anmol-Singh-Jaggi/e679bc310e5ea0f9c08917e6df97eda6 to your computer and use it in GitHub Desktop.
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