ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/extra/SequenceLock.java
(Generate patch)

Comparing jsr166/src/jsr166e/extra/SequenceLock.java (file contents):
Revision 1.1 by dl, Fri Oct 12 14:09:35 2012 UTC vs.
Revision 1.7 by jsr166, Sun Jan 18 20:17:33 2015 UTC

# Line 5 | Line 5
5   */
6  
7   package jsr166e.extra;
8 +
9   import java.util.concurrent.TimeUnit;
10   import java.util.concurrent.TimeoutException;
11   import java.util.concurrent.locks.Lock;
# Line 40 | Line 41 | import java.io.IOException;
41   * threads invoke short read-only methods much more frequently than
42   * fully locked methods.
43   *
44 < * <p> Methods {@code awaitAvailability} and {@code getSequence} can
44 > * <p>Methods {@code awaitAvailability} and {@code getSequence} can
45   * be used together to define (partially) optimistic read-only methods
46   * that are usually more efficient than ReadWriteLocks when they
47   * apply.  These methods should in general be structured as loops that
# Line 109 | Line 110 | public class SequenceLock implements Loc
110      private static final long serialVersionUID = 7373984872572414699L;
111  
112      static final class Sync extends AbstractQueuedLongSynchronizer {
113 <        static final long serialVersionUID = 2540673546047039555L;
113 >        private static final long serialVersionUID = 2540673546047039555L;
114  
115          /**
116           * The number of times to spin in lock() and awaitAvailability().
# Line 257 | Line 258 | public class SequenceLock implements Loc
258  
259      /**
260       * Creates an instance of {@code SequenceLock} that will retry
261 <     * attempts to acquire the lock at least the given number times
261 >     * attempts to acquire the lock at least the given number of times
262       * before blocking.
263 +     *
264 +     * @param spins the number of times before blocking
265       */
266      public SequenceLock(int spins) { sync = new Sync(spins); }
267  
# Line 483 | Line 486 | public class SequenceLock implements Loc
486       *         the lock could be acquired
487       * @throws InterruptedException if the current thread is interrupted
488       * @throws NullPointerException if the time unit is null
486     *
489       */
490      public boolean tryLock(long timeout, TimeUnit unit)
491          throws InterruptedException {
# Line 509 | Line 511 | public class SequenceLock implements Loc
511       * Throws UnsupportedOperationException. SequenceLocks
512       * do not support Condition objects.
513       *
514 <     * @throws UnsupportedOperationException
514 >     * @throws UnsupportedOperationException always
515       */
516      public Condition newCondition() {
517          throw new UnsupportedOperationException();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines