JDK-6312446 : (spec thread) Bring Thread.sleep spec in line with JLS 17.9
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-08-17
  • Updated: 2010-04-02
  • Resolved: 2005-09-04
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 6
6 b51Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
The Thread.sleep javadoc does not reflect JLS section 17.9, omitting ",subject to the precision and accuracy of system timers and schedulers."

Comments
SUGGESTED FIX *** src/share/classes/java/lang/Thread.java- Wed Aug 17 16:01:27 2005 --- Thread.java Wed Aug 17 15:59:10 2005 *** 238,272 **** --- 238,275 ---- public static native Thread currentThread(); /** * Causes the currently executing thread object to temporarily pause * and allow other threads to execute. */ public static native void yield(); /** * Causes the currently executing thread to sleep (temporarily cease ! * execution) for the specified number of milliseconds. The thread ! * execution) for the specified number of milliseconds, subject to + * the precision and accuracy of system timers and schedulers. The thread * does not lose ownership of any monitors. * * @param millis the length of time to sleep in milliseconds. * @exception InterruptedException if another thread has interrupted * the current thread. The <i>interrupted status</i> of the * current thread is cleared when this exception is thrown. * @see java.lang.Object#notify() */ public static native void sleep(long millis) throws InterruptedException; /** * Causes the currently executing thread to sleep (cease execution) * for the specified number of milliseconds plus the specified number ! * of nanoseconds. The thread does not lose ownership of any monitors. ! * of nanoseconds, subject to the precision and accuracy of system + * timers and schedulers. The thread does not lose ownership of any + * monitors. *
17-08-2005

EVALUATION API javadoc should agree with the JLS. The synopsis of this bug is misleading, as it implies *all* of 17.9 relevant to sleep should go into the javadoc, and this is absolutely true: but this CR only added the clause mentioned in the description. See 6317167 for the CR that will complete the JLS/javadoc synchronization in regard to sleep.
17-08-2005