public class HazelcastLockSource extends Object implements LockSource
Uses a Hazelcast map and a Hazelcast multimap, defaulting to the names "com.threecrickets.prudence.prudence.cache" and "com.threecrickets.prudence.prduence.cacheTags" respectively. Refer to Hazelcast documentation for instructions on how to configure them.
Constructor and Description |
---|
HazelcastLockSource()
Constructor.
|
HazelcastLockSource(com.hazelcast.core.HazelcastInstance hazelcast)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
discard(String key)
Discards the lock for a key.
|
void |
discardAll()
Discards all locks.
|
Lock |
getReadLock(String key)
Gets a unique lock for a key.
|
Lock |
getWriteLock(String key)
Gets a unique lock for a key.
|
public HazelcastLockSource()
public HazelcastLockSource(com.hazelcast.core.HazelcastInstance hazelcast)
hazelcast
- The hazelcast instance or null to use the instance named
"com.threecrickets.prudence"public Lock getReadLock(String key)
LockSource
getReadLock
in interface LockSource
key
- The keypublic Lock getWriteLock(String key)
LockSource
getWriteLock
in interface LockSource
key
- The keypublic void discard(String key)
LockSource
discard
in interface LockSource
key
- The keypublic void discardAll()
LockSource
discardAll
in interface LockSource
Copyright © 2009-2016 Three Crickets LLC.