public class AdaptedSemaphoreNamedLock extends NamedLockSupport
| Modifier and Type | Class and Description |
|---|---|
static interface |
AdaptedSemaphoreNamedLock.AdaptedSemaphore
Wrapper for semaphore-like stuff, that do not share common ancestor.
|
logger| Constructor and Description |
|---|
AdaptedSemaphoreNamedLock(String name,
NamedLockFactorySupport factory,
AdaptedSemaphoreNamedLock.AdaptedSemaphore semaphore) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
lockExclusively(long time,
TimeUnit unit)
Tries to lock exclusively, may block for given time.
|
boolean |
lockShared(long time,
TimeUnit unit)
Tries to lock shared, may block for given time.
|
void |
unlock()
Unlocks the lock, must be invoked by caller after one of the
NamedLock.lockShared(long, TimeUnit) or NamedLock.lockExclusively(long, TimeUnit). |
close, namepublic AdaptedSemaphoreNamedLock(String name, NamedLockFactorySupport factory, AdaptedSemaphoreNamedLock.AdaptedSemaphore semaphore)
public boolean lockShared(long time, TimeUnit unit) throws InterruptedException
NamedLocktrue.InterruptedExceptionpublic boolean lockExclusively(long time, TimeUnit unit) throws InterruptedException
NamedLocktrue.InterruptedExceptionpublic void unlock()
NamedLockNamedLock.lockShared(long, TimeUnit) or NamedLock.lockExclusively(long, TimeUnit).Copyright © 2010–2022 The Apache Software Foundation. All rights reserved.