blocking call
A call that makes the current thread wait, doing nothing else, until some result or event arrives.
In more detail
Future.get, CompletableFuture.join, database queries and network requests all block. Blocking a request thread holds it hostage; blocking inside a pool that must run the very task you wait for can deadlock. Block only where waiting is safe and bounded by a timeout.
Related terms
- Future — An object representing the result of a task that may not have finished yet; get waits for it.
- timeout — A limit on how long a caller waits for an answer before giving up.
- CompletableFuture — A Future that can be completed later and chained, letting you describe asynchronous steps such as transform, combine and recover without nesting callbacks.
- thread pool — A fixed or bounded set of reusable worker threads that take tasks from a queue, instead of creating a new thread for each task.
Taught in
- The ExecutorService — Modern Java: Virtual Threads & High-Throughput Services
- Async With CompletableFuture — Modern Java: Virtual Threads & High-Throughput Services