Interface LockHandler

All Superinterfaces:
Serializable
All Known Implementing Classes:
LockHandlerImpl

public interface LockHandler extends Serializable
Code execution locked on some shared resource.

Locks are either specific to a tld or global to the entire system, in which case a tld of null is used.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    executeWithLocks(Callable<Void> callable, String tld, org.joda.time.Duration leaseLength, String... lockNames)
    Acquire one or more locks and execute a Void Callable.
  • Method Details

    • executeWithLocks

      boolean executeWithLocks(Callable<Void> callable, @Nullable String tld, org.joda.time.Duration leaseLength, String... lockNames)
      Acquire one or more locks and execute a Void Callable.

      Runs on a thread that will be killed if it doesn't complete before the lease expires.

      Note that locks are specific either to a given tld or to the entire system (in which case tld should be passed as null).

      Returns:
      true if all locks were acquired and the callable was run; false otherwise.