[concurrency-interest] missed deadlines.
dcholmes at optusnet.com.au
Thu Jul 6 17:11:57 EDT 2006
Just to clarify a little on terminology ...
> I'm wondering why there is no functionality for dealing with missed
A deadline is when a task should be completed by, not when it should be
released by. Of course if your release is delayed long enough then you will
miss your deadline too.
ScheduledExecutor and Timer are best-effort mechanisms to release tasks at a
given time or periodically. If there is too much happening in the system, or
if the executor is under resourced then tasks can be released much later
than expected. If this is an issue for a task then the task should keep
track of its release times and act accordingly.
> 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.
You could have various "I'm late" policies but then you'd have to specify
the policy for each task (I don't thing a per-executor policy works well for
this situation). And there are so many things you could do if late. Better
for the task to make such decisions in my view.
There could be an API to assist this, but a task would have to know it was
being executed in a ScheduledExecutor - which a basic Runnable or Callable
> 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?
I agree that ScheduledTPE needs further thought in the area of pool sizing.
It is stuck at only coreSize. I believe in Mustang allowCoreThreadTimeout
can be set so that would allow the pool to grow and shrink based on demand,
but even so I suspect that the policy of favouring thread creation when
below coreSize would not be ideal.
More information about the Concurrency-interest