Hello, I have a question about answer E to question 25
The question goes as follows:
Assuming an implementation of the performCount() method is provided prior to runtime, which of the following are possible results of executing the following application? (Choose all that apply.)
..
E. It hangs indefinitely at runtime.
..
So in the Answers section it is said that
Finally, it is also possible for our performCount() to hang indefinitely, such as with a deadlock or infinite loop. Luckily, the call to get() includes a timeout value. While each call to Future.get() can wait up to a day for a result, it will eventually finish, so option E is incorrect.
While it's true that
f.get(1, TimeUnit.DAYS) can't hang indefinetely, application itself can. If we consider that implementation for
performCount() is
while(true){}, call to
s.shutdown() (and even
s.shutdownNow()) would not stop submitted task from running, meaning the application won't terminate, as there are alive non-daemon threads.
What am I missing?