Card 09/ 09

RecapDifficulty: Advanced1 min

Submit, Wait, Shut Down

Five things this topic established, and where each one was.

What the topic established, and which card it was on
The thingWhere
A pool separates what work there is from which thread runs itHanding Work to a Pool
Callable returns a value and may throw; Runnable does neitherRunnable Against Callable
get() blocks, so submit everything before collecting anythingWhat Future.get() Does
shutdown asks, awaitTermination waits, shutdownNow insistsShutting a Pool Down
A pool nobody shuts down keeps the process alive with nothing to doWhy Your Program Hung After main Returned

The one worth carrying: submitting is not running and getting is waiting. Almost every disappointing result from a thread pool is one of those two sentences being forgotten at a call site.