I have one task producer and several hardware resources for execute them So, I try to create executers with shared queue
BlockingQueue<Runnable> queue; ExecutorService executor1 = new ThreadPoolExecutor(poolSize1, poolSize1, 0L, TimeUnit.MILLISECONDS, queue, threadFactory); ExecutorService executor2 = new ThreadPoolExecutor(poolSize2, poolSize2, 0L, TimeUnit.MILLISECONDS, queue, threadFactory); ExecutorService executor3 = new ThreadPoolExecutor(poolSize3, poolSize3, 0L, TimeUnit.MILLISECONDS, queue, threadFactory);
and (just try) to add task to queue.put(task) instead of specific executorN.execute(task) But, execurer doesn't create thread until execute(task) call.
So, I need an implementation of Executor? which run task on any free thread of sub-execurer. Maybe you know the solution/library which can be used?
This is not a balancer. I don't care where the task will start. Let it stand in queue until it is taken by a free handler