advancedMultithreading & Concurrency355 of 436

Why is holding a lock while making a network call dangerous?

Tests whether you know a slow or hung network call turns a short critical section into an unbounded one, blocking every other thread waiting on that lock for as long as the network call takes -- effectively letting an external dependency's latency become your application's lock contention.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

← Back to all Core Java questions