Bird
0
0

What happens when the task queue is full and the thread pool has reached its maximum size in Spring Boot's ThreadPoolTaskExecutor?

medium📝 component behavior Q5 of 15
Spring Boot - Async Processing
What happens when the task queue is full and the thread pool has reached its maximum size in Spring Boot's ThreadPoolTaskExecutor?
ANew tasks are queued indefinitely
BNew tasks are rejected and an exception is thrown
CThe thread pool automatically increases max size
DTasks are executed on the main thread
Step-by-Step Solution
Solution:
  1. Step 1: Understand thread pool rejection policy

    When max threads and queue are full, new tasks are rejected.
  2. Step 2: Identify default behavior in Spring Boot

    By default, ThreadPoolTaskExecutor throws RejectedExecutionException on rejection.
  3. Final Answer:

    New tasks are rejected and an exception is thrown -> Option B
  4. Quick Check:

    Full pool + queue = task rejection [OK]
Quick Trick: Full pool rejects new tasks with exception [OK]
Common Mistakes:
  • Assuming queue grows indefinitely
  • Thinking thread pool auto-expands max size
  • Believing tasks run on main thread automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes