Executorsmedium3-5 years
thenApply vs thenCompose — and which thread runs the callback?
thenApply maps the result with a function returning a value; thenCompose takes a function returning a future and flattens it — map versus flatMap. Using thenApply there yields a nested future. A plain callback runs on the completing thread, or on the calling thread if the stage is already done; the Async variants dispatch to an executor.
PreviousExplain ThreadPoolExecutor's parameters and how a task moves through them.Next How is ConcurrentHashMap different from Collections.synchronizedMap, and what is still not atomic?