When i use Executors.newFixedThreadPool(10), does the framework internally create a blockingqueue? Is there a way to supply my own queue while creating the thread pool? It is not clear to me from the oracle docs:here
Asked
Active
Viewed 557 times
0
-
you may need more tags, are you talking about java? maybe it would be more visible to java people if you tagged it as such. – Grady Player Jul 05 '13 at 21:11
1 Answers
1
Yes, it does, as found here.
Usually you do want a blocking queue, as the purpose of the queue is to hold on to jobs to prevent overwhelming Executor
. You could implement your own Executor
+ ExecutorService
and use your custom queue in there, or, you could use a ThreadPoolExecutor
with your impl, similar to this:
88 public static ExecutorService More ...newFixedThreadPool(int nThreads) {
89 return new ThreadPoolExecutor(nThreads, nThreads,
90 0L, TimeUnit.MILLISECONDS,
91 new LinkedBlockingQueue<Runnable>());
92 }
If the queue isn't blocking, then you'll start rejecting tasks, as mentioned here.

foamroll
- 752
- 7
- 23