Bird
0
0

What happens if a long-running task is executed synchronously in a Spring Boot REST controller?

easy📝 Conceptual Q2 of 15
Spring Boot - Async Processing
What happens if a long-running task is executed synchronously in a Spring Boot REST controller?
AThe server automatically converts it to async processing
BThe task runs in the background without blocking the server thread
CThe task is ignored and not executed
DThe server thread waits and blocks other requests until the task finishes
Step-by-Step Solution
Solution:
  1. Step 1: Understand synchronous task behavior

    Synchronous means the server waits for the task to finish before continuing, blocking the thread.
  2. Step 2: Match behavior to options

    Only The server thread waits and blocks other requests until the task finishes correctly describes the blocking behavior of synchronous tasks.
  3. Final Answer:

    The server thread waits and blocks other requests until the task finishes -> Option D
  4. Quick Check:

    Synchronous task = Blocking server thread [OK]
Quick Trick: Sync tasks block server threads until done [OK]
Common Mistakes:
  • Assuming sync tasks run in background
  • Thinking server auto-switches to async
  • Believing tasks can be ignored

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes