If I create a fixed size thread pool with 10 threads in java using Executor framework:
private final ExecutorService pool;
pool = Executors.newFixedThreadPool(10);
and then try to submit more than 10 tasks (say for an example, 12 tasks);
for (int i = 0 ; i < 12 ; i++) {
pool.execute(new Handler(myRunnable));
}
What will happen to the extra tasks (extra two tasks as per the example of 12 tasks)? Will they be blocked until a thread has finished its work?
Quoting the Javadoc for
Executors.newFixedThreadPool(int nThreads)(emphasis mine):The Javadocs for code as mature as the Java Concurrency Framework contain a great wealth of knowledge. Keep them close.