United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6620549 : ExecutorService#shutdown should clearly state that it does not block

Details
Type:
Bug
Submit Date:
2007-10-23
Status:
Closed
Updated Date:
2011-05-18
Project Name:
JDK
Resolved Date:
2011-05-18
Component:
core-libs
OS:
solaris_10
Sub-Component:
java.util.concurrent
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports

Sub Tasks

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



Hardware and Software, Engineered to Work Together