Interface LockHandler

  • All Superinterfaces:
    java.io.Serializable
    All Known Implementing Classes:
    LockHandlerImpl

    public interface LockHandler
    extends java.io.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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean executeWithLocks​(java.util.concurrent.Callable<java.lang.Void> callable, java.lang.String tld, org.joda.time.Duration leaseLength, java.lang.String... lockNames)
      Acquire one or more locks and execute a Void Callable.
    • Method Detail

      • executeWithLocks

        boolean executeWithLocks​(java.util.concurrent.Callable<java.lang.Void> callable,
                                 @Nullable
                                 java.lang.String tld,
                                 org.joda.time.Duration leaseLength,
                                 java.lang.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.