2.1 Lock Service
The Lock Service is a distributed lock service, which is intended for use in a cluster where processes in different nodes1 might compete with each other for access to a shared resource.
The Lock Service provides entities called lock resources, which application processes use to coordinate access to shared resources.
The Lock Service provides a simple lock model supporting two locking modes for exclusive access and shared access.
All implementations must offer synchronous and asynchronous calls, lock timeout, trylock, and lock wait notifications.
Implementations may optionally offer the additional features of deadlock detection and lock orphaning.
A Lock Service interface allows an application to query for support for one or more of the optional features.
If an application depends on one of the optional features for proper operation, it should use this interface to check whether the feature is provided.
Maximum portability is achieved by avoiding use of the optional features.
However, because they offer powerful functionality, it may make sense to take advantage of them when they are available.
The locks provided by the Lock Service are not recursive.
Thus, claiming one lock does not implicitly claim another lock; rather, each lock must be claimed individually.