I have a big file up to terabytes, and my task is to process line by line. Each line should take 5s to accomplish. To improve the performance I dispatch the process to a fixed thread pool like this
ExecutorService executor = Executors.newFixedThreadPool(5);
while ((line = br.readLine()) != null) {
Runnable worker = new WorkerThread(line);
executor.execute(worker);
}
My question is what happens if I overwhelm the executor's queue by putting so many tasks. Does it throw StackOverflow?