Package org.eclipse.aether.named.support
Class ReadWriteLockNamedLock
java.lang.Object
org.eclipse.aether.named.support.NamedLockSupport
org.eclipse.aether.named.support.ReadWriteLockNamedLock
- All Implemented Interfaces:
AutoCloseable
,NamedLock
Named lock support implementation that is using
ReadWriteLock
instances. The adapted lock MUST SUPPORT
reentrancy, non re-entrant locks will NOT work. It is the responsibility of an adapting lock, to ensure that
above lock requirement stands.-
Field Summary
Fields inherited from class org.eclipse.aether.named.support.NamedLockSupport
logger
-
Constructor Summary
ConstructorDescriptionReadWriteLockNamedLock
(String name, NamedLockFactorySupport factory, ReadWriteLock readWriteLock) -
Method Summary
Modifier and TypeMethodDescriptionboolean
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 theNamedLock.lockShared(long, TimeUnit)
orNamedLock.lockExclusively(long, TimeUnit)
.Methods inherited from class org.eclipse.aether.named.support.NamedLockSupport
close, name
-
Constructor Details
-
ReadWriteLockNamedLock
public ReadWriteLockNamedLock(String name, NamedLockFactorySupport factory, ReadWriteLock readWriteLock)
-
-
Method Details
-
lockExclusively
Description copied from interface:NamedLock
Tries to lock exclusively, may block for given time. If successful, returnstrue
.- Throws:
InterruptedException
-
unlock
Description copied from interface:NamedLock
Unlocks the lock, must be invoked by caller after one of theNamedLock.lockShared(long, TimeUnit)
orNamedLock.lockExclusively(long, TimeUnit)
.