|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
@PublicApi public interface ClusterLockService
Provides methods for running code under a cluster-wide lock.
For safety reasons, an acquired lock will never time-out. However if the node that holds the lock is shutdown or is unable to reach the DB for an extended period then the lock is considered to no longer be valid and can be acquired by another node.
The Locks returned by this service are re-entrant.
A simple implementation of this Service can be provided by single-node apps in order to satisfy cross-product libraries that need it.
Lock names can be up to 255 characters. Obviously they should be namespaced adequately to avoid conflicts with other plugins - the reverse DNS name convention is recommended. Some implementations will store the lock name in the underlying database, and so the name may be treated as case-sensitive in some environments, and case-insensitive in other environments. To avoid unforeseen compatibility issues, consumers are recommended to use names that consist of "simple" ASCII characters (eg alphanumeric, hyphen and underscore).
Application developers should consider using one of the implementations provided by beehive-core or
beehive-hazelcast instead of creating an implementation that is specific to the application.
SimpleClusterLockService (beehive-core) — for single node applicationsDatabaseClusterLockService (beehive-core) — for clustered applications that
use database objects to control cluster-wide locking behaviourHazelcastClusterLockService (beehive-hazelcast) — for clustered applications
that can use the Hazelcast library to implement distributed messaging and locking
| Method Summary | |
|---|---|
ClusterLock |
getLockForName(String lockName)
Returns the cluster-wide lock for the given name. |
| Method Detail |
|---|
ClusterLock getLockForName(@Nonnull
String lockName)
lockName - the globally unique lock identifier
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||