JDK-6620549 : ExecutorService#shutdown should clearly state that it does not block
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: x86
  • Submitted: 2007-10-23
  • Updated: 2011-05-18
  • Resolved: 2011-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b25Fixed
Description
A DESCRIPTION OF THE REQUEST :
I've several times encountered that people call ExecutorService#shutdown and expect it to block until the remaining tasks have executed (awaitTermination does that for you). Only a code sample in the general class section suggests that #shutdown does not wait. Maybe the method should have been called #initiateShutdown.

The JavaDoc could make this more clear, through a @see #awaitTermination cross reference or similar.


JUSTIFICATION :
I have anecdotal evidence that this is a common misconception.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The method javadoc of #shutdown clearly states that shutdown does not wait for the current tasks to finish.
ACTUAL -
You have to read the general section or see the #awaitTermination method in order to learn this.

Comments
EVALUATION Agreed.
2007-10-28