I was reading a question on "careercup" and come across following problem:
A server receives requests from different clients...each client send a Runnable job and time on which this job should be run. Write a java program that would
accept these jobs and run each job at the required time.
I am able to do the same using DelayQueue.
But i am thinking to solve it from other ways as well. Like using priority queue or linked blocking queue. I thought about the prons-cons about them. Kindly let me know
about your thoughts. My thoughts about them as below:
1) Priority Queue: The idea is to remove shortest time required to run the job, schedule it in the new
thread and move to other.
2) LinkedBlockingQueue: Remove one by one and start schedule them using new thread.
Cons for both the approach: Many threads needs to be opened. Secondly as we have to schedule the thread so it doesn't matter whether we remove small
interval or largest interval.