Package org.eclipse.aether.named.support
Class AdaptedSemaphoreNamedLock
java.lang.Object
org.eclipse.aether.named.support.NamedLockSupport
org.eclipse.aether.named.support.AdaptedSemaphoreNamedLock
- All Implemented Interfaces:
AutoCloseable
,NamedLock
Named lock support implementation that is using "adapted" semaphore (to be able to use semaphores not sharing common
API).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Wrapper for semaphore-like stuff, that do not share common ancestor. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
Count of permissions involved with exclusive lockingprivate static final int
Count of permissions involved with "nop" locking.private final AdaptedSemaphoreNamedLock.AdaptedSemaphore
private static final int
Count of permissions involved with shared lockingprivate final ThreadLocal
<Deque<Integer>> Fields inherited from class org.eclipse.aether.named.support.NamedLockSupport
logger
-
Constructor Summary
ConstructorsConstructorDescriptionAdaptedSemaphoreNamedLock
(String name, NamedLockFactorySupport factory, AdaptedSemaphoreNamedLock.AdaptedSemaphore semaphore) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
doLockExclusively
(long time, TimeUnit unit) protected boolean
doLockShared
(long time, TimeUnit unit) protected void
doUnlock()
Methods inherited from class org.eclipse.aether.named.support.NamedLockSupport
close, diagnosticState, doClose, lockExclusively, lockShared, name, toString, unlock
-
Field Details
-
NONE
private static final int NONECount of permissions involved with "nop" locking. When required lock step is preceded with a step that already fulfills currently requested locking, no locking is needed. In other words, caller already possesses the access to lock protected resource. The "nop" locking is used to track proper "boxing" of lock/unlock calls.- See Also:
-
SHARED
private static final int SHAREDCount of permissions involved with shared locking- See Also:
-
EXCLUSIVE
private static final int EXCLUSIVECount of permissions involved with exclusive locking- See Also:
-
threadPerms
-
semaphore
-
-
Constructor Details
-
AdaptedSemaphoreNamedLock
public AdaptedSemaphoreNamedLock(String name, NamedLockFactorySupport factory, AdaptedSemaphoreNamedLock.AdaptedSemaphore semaphore)
-
-
Method Details
-
doLockExclusively
- Specified by:
doLockExclusively
in classNamedLockSupport
- Throws:
InterruptedException
-
doUnlock
protected void doUnlock()- Specified by:
doUnlock
in classNamedLockSupport