PrepZone Logo
PrepZone
Back to Java

Java · Medium

What happens if you submit too many tasks to a thread pool?

JavaConcurrency

Answer preview

When you submit a task: if a core thread is free → task runs immediately. If all core threads are busy → task goes to the work queue. If the queue is full → a new thread is created (up to maxPoolSize). If pool and queue are both full → the RejectedExecutionHandler is invoked.…