protected class LockService.LockImpl extends Object implements Lock
Lock. This is a client stub communicates with a server equivalent. The semantics are
more or less those of Lock, but may differ slightly.
There is no reference counting of lock owners, so acquisition of a lock already held by a thread is a no-op.
Also, releasing the lock after it was already released is a no-op as well.
An exact description is provided below.| Modifier and Type | Field and Description |
|---|---|
protected AtomicReference<Thread> |
holder |
protected String |
name |
| Modifier and Type | Method and Description |
|---|---|
void |
lock()
Blocks until the lock has been acquired.
|
void |
lockInterruptibly()
If the thread is interrupted at entry, the call will throw an InterruptedException immediately and the lock
won't be acquired.
|
Condition |
newCondition()
This condition object is only allowed to work 1 for each lock.
|
String |
toString() |
boolean |
tryLock()
If the thread is interrupted at entry or during the call, no InterruptedException will be thrown, but the
thread's status will be set to interrupted upon return.
|
boolean |
tryLock(long time,
TimeUnit unit)
* If the thread is interrupted at entry, the call will throw an InterruptedException immediately and the lock
won't be acquired.
|
void |
unlock()
Releases a lock.
|
protected final String name
protected final AtomicReference<Thread> holder
public LockImpl(String name)
public void lock()
public void lockInterruptibly()
throws InterruptedException
lockInterruptibly in interface LockInterruptedExceptionpublic boolean tryLock()
public boolean tryLock(long time,
TimeUnit unit)
throws InterruptedException
tryLock in interface Locktime - unit - InterruptedExceptionpublic void unlock()
public Condition newCondition()
newCondition in interface LockCopyright © 2025 JBoss, a division of Red Hat. All rights reserved.