public class SemaphoreKeeperGuavaImpl<K> extends Object implements SemaphoreKeeper<K>
Constructor and Description |
---|
SemaphoreKeeperGuavaImpl(int permits,
boolean fair) |
Modifier and Type | Method and Description |
---|---|
void |
releaseGuard(Semaphore guard)
Unlock and release guard.
|
Semaphore |
summonGuard(K key)
Create or load semaphore for key from cache.
|
Semaphore |
summonGuardAndAcquire(K key)
Get guard and lock for key.
|
public SemaphoreKeeperGuavaImpl(int permits, boolean fair)
public Semaphore summonGuard(@Nonnull K key)
SemaphoreKeeper
summonGuard
in interface SemaphoreKeeper<K>
key
- semaphore identifierpublic Semaphore summonGuardAndAcquire(@Nonnull K key)
SemaphoreKeeper
summonGuardAndAcquire
in interface SemaphoreKeeper<K>
key
- for which guard should be created and acquiredpublic void releaseGuard(@Nullable Semaphore guard)
SemaphoreKeeper
releaseGuard
in interface SemaphoreKeeper<K>
guard
- semaphore guard which should be releasedCopyright © 2020 OpenDaylight. All rights reserved.