[concurrency-interest] missed deadlines.

Peter Veentjer alarmnummer at gmail.com
Thu Jul 6 13:24:20 EDT 2006


I have a question regarding missed deadlines and java.util.Timer and
java.util.concurrent.ScheduledThreadPoolExecutor.

I'm wondering why there is no functionality for dealing with missed
deadlines. Within a Timer you have one thread, if a job takes a long
time, the other tasks are 'queued' untill the long-job has finished.
When that job finishes, all other queued-jobs are run and I think this
could lead to some serious issues. I can image you want to have some
control like:
-execute it
-drop it
-do something else like sending a message.

The same goes for the ScheduledThreadPoolExecutor. If a job takes a
long time and a different job needs to be scheduled, a free thread is
used (if one is available). If no free thread is available, you get
the same problems as with the Timer.

Another think I'm wondering about is the fixed size of the threadpool
of the scheduledthreadpoolexecutor. I can image it would be usefull
that a threadpool increases if there are no available threads to
execute a scheduled task and if those 'extra' threads aren't used for
some time, they could be discarded. Am I missing something?

Peter


More information about the Concurrency-interest mailing list