Looking for a solution to optimise processing of workloads, which are coming either from background or from API task sources. Task code is just the single Callable class. I guess that having two separate thread pools for different task sources is less elegant solution. So i need the following properties that ExecutorService should have
- dynamically dynamically adjust task execution order based on Comparable interface.
java.util.concurrent.PriorityBlockingQueue
does that already. I can pass it as argument tojava.util.concurrent.ThreadPoolExecutor
, so that's already handled. - number of threads is preferred to scale up and down dynamically (c)
As long as Java community is dynamic, maybe somebody did already solve this problem into any available library? Or should I override PriorityBlockingQueue methods?