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

Comparing jsr166/src/jsr166e/SequenceLock.java (file contents):
Revision 1.8 by dl, Mon Jul 18 14:44:29 2011 UTC vs.
Revision 1.9 by dl, Wed Jul 20 20:29:29 2011 UTC

# Line 43 | Line 43 | import java.io.IOException;
43   * <p> Methods {@code awaitAvailability} and {@code getSequence} can
44   * be used together to define (partially) optimistic read-only methods
45   * that are usually more efficient than ReadWriteLocks when they
46 < * apply.  These read-only methods typically read multiple field
47 < * values into local variables when the lock is not held, retrying if
48 < * the sequence number changed while doing so.  Alternatively, because
49 < * {@code awaitAvailability} accommodates reentrancy, a method can
50 < * retry a bounded number of times before switching to locking mode.
51 < * While conceptually straightforward, expressing these ideas can be
52 < * verbose. For example:
46 > * apply.  These read-only methods typically read multiple {@code
47 > * volatile} field values into local variables when the lock is not
48 > * held, retrying if the sequence number changed while doing so.
49 > * Alternatively, because {@code awaitAvailability} accommodates
50 > * reentrancy, a method can retry a bounded number of times before
51 > * switching to locking mode.  While conceptually straightforward,
52 > * expressing these ideas can be verbose. For example:
53   *
54   * <pre> {@code
55   * class Point {
56 < *     private double x, y;
56 > *     private volatile double x, y;
57   *     private final SequenceLock sl = new SequenceLock();
58   *
59   *     void move(double deltaX, double deltaY) { // an exclusively locked method

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines