This uses a plain FIFO ArrayBlockingQueue and ThreadPoolExecutor.
This uses a plain FIFO ArrayBlockingQueue and ThreadPoolExecutor. This is faster than the PriorityQueue version since Queue operations happen in constant time but individual Requests can be delayed if they have a lot of remote calls or Future callbacks since each callback will goto the end of the queue.
The number of threads
The max (hard limit) size of the ArrayBlockingQueue
This uses a PriorityBlockingQueue and ThreadPoolExecutor.
This uses a PriorityBlockingQueue and ThreadPoolExecutor. The priority for each Runnable is the starting time of the Request such that Requests are processed in FIFO order. This prevents individual requests from being starved of CPU resources due to having lots of remote calls or Future callbacks since for older requests those callbacks will goto the front of the queue and execute first. The tradeoff being that queue operations take O(log N) time.
The number of threads
The initial (soft) size of our PriorityQueue
A helper to create a PriorityThreadPool or a FIFOThreadPool