ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/TimeUnit.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/TimeUnit.java (file contents):
Revision 1.18 by dl, Sat Dec 27 19:26:26 2003 UTC vs.
Revision 1.19 by dl, Sun Jan 11 23:19:55 2004 UTC

# Line 21 | Line 21 | package java.util.concurrent;
21   * precision. If you use these frequently, consider statically
22   * importing this class.
23   *
24 < * <p>A <tt>TimeUnit</tt> is mainly used to inform blocking methods which
25 < * can timeout, how the timeout parameter should be interpreted. For example,
26 < * the following code will timeout in 50 milliseconds if the {@link java.util.concurrent.locks.Lock lock}
27 < * is not available:
24 > * <p>A <tt>TimeUnit</tt> is mainly used to inform blocking timeout
25 > * methods how the timeout parameter should be interpreted. For
26 > * example, the following code will timeout in 50 milliseconds if the
27 > * {@link java.util.concurrent.locks.Lock lock} is not available:
28 > *
29   * <pre>  Lock lock = ...;
30   *  if ( lock.tryLock(50L, TimeUnit.MILLISECONDS) ) ...
31   * </pre>
# Line 183 | Line 184 | public final class TimeUnit implements j
184  
185      /**
186       * Perform a timed <tt>Object.wait</tt> using this time unit.
187 <     * This is a convenience method that converts timeout arguments into the
188 <     * form required by the <tt>Object.wait</tt> method.
189 <     * <p>For example, you could implement a blocking <tt>poll</tt> method (see
190 <     * {@link BlockingQueue#poll BlockingQueue.poll} using:
187 >     * This is a convenience method that converts timeout arguments
188 >     * into the form required by the <tt>Object.wait</tt> method.
189 >     *
190 >     * <p>For example, you could implement a blocking <tt>poll</tt>
191 >     * method (see {@link BlockingQueue#poll BlockingQueue.poll}
192 >     * using:
193 >     *
194       * <pre>  public synchronized  Object poll(long timeout, TimeUnit unit) throws InterruptedException {
195       *    while (empty) {
196       *      unit.timedWait(this, timeout);
197       *      ...
198       *    }
199       *  }</pre>
200 +     *
201       * @param obj the object to wait on
202       * @param timeout the maximum time to wait.
203       * @throws InterruptedException if interrupted while waiting.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines