フリー問題

Java SE 17 Developer のフリー問題 15 / 20 問目

問題文

Tasks that a pool runs sometimes raise a RuntimeException, and nothing about those failures shows up in the log. The tasks were handed over with submit. What explains the silence?

選択肢

  1. The failure is kept inside the Future that submit returned, so nothing is reported until the code calls get on that Future
  2. The pool discards a failure from a task on purpose, because a pool has to stay usable and therefore drops anything that a single task raised
  3. The execute method keeps failures inside a Future as well, so both ways of handing work over end in the same silence
  4. The exception reaches the thread that submitted the task, which swallows it because it has moved on

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。