An Executor that:
- minimizes thread creation
- allows for proper timeout of idle threads
- allows for queuing
A non-fifo (lifo)
satisfies 1 and 2, but not 3.
A bounded or unbound queue based
allows for 3, but will tend to create
up to the maximum number of threads and makes no guarantee on thread scheduling.
So the approach here is to use a virtual thread pool off of a
There is also only a single master scheduling thread with actual executions deferred.
TODO: there is a race condition between retiring threads and adding work, which may create extra threads.
That is a flaw with attempting to reuse, rather than create threads.
TODO: bounded queuing - we never bothered bounding in the past with our worker pools, but reasonable
defaults would be a good idea.
is a simple replacement, but we'd loose the prioritization queue.