Class Lock

java.lang.Object
google.registry.model.ImmutableObject
google.registry.model.server.Lock
All Implemented Interfaces:
Serializable, Cloneable

@Entity public class Lock extends ImmutableObject implements Serializable
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:
  • 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.