32 |
|
private static class Sync extends AbstractQueuedSynchronizer { |
33 |
|
boolean isLocked() { return getState() == 1; } |
34 |
|
|
35 |
< |
public boolean tryAcquireExclusive(boolean isQueued, int acquires) { |
35 |
> |
public boolean tryAcquireExclusive(int acquires) { |
36 |
|
assert acquires == 1; // Does not use multiple acquires |
37 |
|
return compareAndSetState(0, 1); |
38 |
|
} |
57 |
|
|
58 |
|
private final Sync sync = new Sync(); |
59 |
|
public boolean tryLock() { |
60 |
< |
return sync.tryAcquireExclusive(false, 1); |
60 |
> |
return sync.tryAcquireExclusive(1); |
61 |
|
} |
62 |
|
public void lock() { |
63 |
|
sync.acquireExclusiveUninterruptibly(1); |