Interface LockExecutor

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void execute​(Runnable task)
      Executes the given task, with the guarantee no other task for the same lock can run concurrently.
      <V> V execute​(Callable<V> task)
      Executes the given task and returns its computed result, with the guarantee no other task for the same lock can run concurrently.
    • Method Detail

      • execute

        default void execute​(Runnable task)
        Executes the given task, with the guarantee no other task for the same lock can run concurrently.

        The task is expected to be very lightweight and short-running, so that it does't block for too long other concurrent requests.

        Specified by:
        execute in interface Executor
        Throws:
        CompletionException - if the task is either interrupted or the timeout to acquire the lock expires.
      • execute

        <V> V execute​(Callable<V> task)
               throws Exception
        Executes the given task and returns its computed result, with the guarantee no other task for the same lock can run concurrently.

        The task is expected to be very lightweight and short-running, so that it does't block for too long other concurrent requests.

        Type Parameters:
        V - the result type of method call
        Parameters:
        task - the runnable task
        Returns:
        the computed result
        Throws:
        Exception - if unable to compute a result. The exception is a CompletionException if the task is either interrupted or the timeout to acquire the lock expires.