76 |
|
* into initial unlocked state, so they are not useful for remote |
77 |
|
* locking. |
78 |
|
* |
79 |
< |
* <p>The scheduling policy of StampedLock does not consistently prefer |
80 |
< |
* readers over writers or vice versa. |
79 |
> |
* <p>The scheduling policy of StampedLock does not consistently |
80 |
> |
* prefer readers over writers or vice versa. A zero return from any |
81 |
> |
* "try" method for acquiring or converting locks does carry any |
82 |
> |
* information about the state of the lock; a subsequent invocation |
83 |
> |
* may succeed. |
84 |
|
* |
85 |
|
* <p><b>Sample Usage.</b> The following illustrates some usage idioms |
86 |
|
* in a class that maintains simple two-dimensional points. The sample |
122 |
|
* } |
123 |
|
* |
124 |
|
* double distanceFromOriginV2() { // combines code paths |
125 |
< |
* for (long stamp = sl.optimisticRead(); ; stamp = sl.readLock()) { |
125 |
> |
* for (long stamp = sl.tryOptimisticRead(); ; stamp = sl.readLock()) { |
126 |
|
* double currentX, currentY; |
127 |
|
* try { |
128 |
|
* currentX = x; |