Lock, ExtendedLockpublic class SpinLock extends Object implements ExtendedLock
Spin locks do not support conditions, and they do not support timed waiting. Normally only the uninterruptible lock,
tryLock, and unlock methods should be used to control the lock.
| Constructor | Description |
|---|---|
SpinLock() |
Construct a new instance.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
isFair() |
Determine if this lock is fair.
|
boolean |
isHeldByCurrentThread() |
Determine if this spin lock is held by the calling thread.
|
boolean |
isLocked() |
Determine if this spin lock is held.
|
void |
lock() |
Acquire the lock by spinning until it is held.
|
void |
lockInterruptibly() |
|
Condition |
newCondition() |
|
boolean |
tryLock() |
|
boolean |
tryLock(long time,
TimeUnit unit) |
|
void |
unlock() |
public boolean isLocked()
isLocked in interface ExtendedLocktrue if the lock is held by any thread, false otherwisepublic boolean isHeldByCurrentThread()
isHeldByCurrentThread in interface ExtendedLocktrue if the lock is held by the calling thread, false otherwisepublic boolean isFair()
isFair in interface ExtendedLocktrue; the lock is fairpublic void lock()
public void lockInterruptibly()
throws InterruptedException
lockInterruptibly in interface LockInterruptedExceptionpublic Condition newCondition()
newCondition in interface LockCopyright © 2018 JBoss by Red Hat. All rights reserved.