Package google.registry.model.server
Class Lock
java.lang.Object
google.registry.model.ImmutableObject
google.registry.model.server.Lock
- All Implemented Interfaces:
Serializable
,Cloneable
A lock on some shared resource.
Locks are either specific to a tld or global to the entire system, in which case a scope of GLOBAL is used.
This is the "barebone" lock implementation, that requires manual locking and unlocking. For safe calls that automatically lock and unlock, see LockHandler.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class google.registry.model.ImmutableObject
ImmutableObject.DoNotHydrate, ImmutableObject.IgnoredInDiffableMap, ImmutableObject.Insignificant
-
Field Summary
Fields inherited from class google.registry.model.ImmutableObject
hashCode
-
Constructor Summary
-
Method Summary
Methods inherited from class google.registry.model.ImmutableObject
clone, cloneEmptyToNull, createVKey, equals, getSignificantFields, hashCode, toDiffableFieldMap, toHydratedString, toString, toStringHelper
-
Constructor Details
-
Lock
public Lock()
-
-
Method Details
-
getExpirationTime
public org.joda.time.DateTime getExpirationTime() -
acquire
public static Optional<Lock> acquire(String resourceName, @Nullable String tld, org.joda.time.Duration leaseLength) Try to acquire a lock. Returns absent if it can't be acquired. -
release
public void release()Release the lock.
-