My question is : does it make sense to use Executors.newFixedThreadPool(1)??
. In two threads (main + oneAnotherThread) scenarios is it efficient to use execut
Sometimes need to use Executors.newFixedThreadPool(1)
to determine number of tasks in the queue
private final ExecutorService executor = Executors.newFixedThreadPool(1);
public int getTaskInQueueCount() {
ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor;
return threadPoolExecutor.getQueue().size();
}