K
- the type of keys to usepublic class MapMutex<K> extends Object
Modifier and Type | Field and Description |
---|---|
int |
permits
The number of permits per key.
|
Constructor and Description |
---|
MapMutex()
Constructor with one permit per key and no cache limit size.
|
MapMutex(int permits)
Constructor with no cache limit size.
|
MapMutex(Integer permits,
Integer cacheLimitSize,
Integer initialSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
acquire(K key)
Acquires a permit for the given key.
|
void |
release(K key)
Releases the permit for the given key.
|
public MapMutex(Integer permits, Integer cacheLimitSize, Integer initialSize)
permits
- the number of permits per key, 1 if nullcacheLimitSize
- the size limit where semaphores will be removed
upon release of all permits, ignored if nullinitialSize
- the initial size of the map, the default HashMap size
if nullpublic MapMutex()
public MapMutex(int permits)
permits
- the number of permits per keypublic void acquire(K key) throws InterruptedException
key
- the keyInterruptedException
- exception thrown if the thread is
interruptedpublic void release(K key) throws InterruptedException
key
- the key to releaseInterruptedException
- exception thrown if the thread is
interruptedCopyright © 2019. All rights reserved.