Module utilities

Interface LockProtectedRunnable


public interface LockProtectedRunnable
A LockProtectedRunnable represents a task which is to be executed within the context of a Lock on a [@link de.grogra.util.Lockable} resource. The execution of the task is induced by one of the execute methods in Lockable.
Author:
Ole Kniemeyer
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run(boolean sync, Lock lock)
    The invocation of this method is induced by one of the execute methods in Lockable.
  • Method Details

    • run

      void run(boolean sync, Lock lock)
      The invocation of this method is induced by one of the execute methods in Lockable. The thread which invokes this method possesses a lock as requested by the invocation of execute. If sync is true, the invocation is synchronous, meaning that it happens directly within the invocation of the execute method. Otherwise, the invocation is asynchronous, meaning that it happens later in a thread which may differ from the original thread.

      Normally, the lock is released after execution of run has finished. However, when the method Lock.retain() has been invoked within run, the lock is retained and remains active in order to be passed to one of the execute methods of Lockable.

      Parameters:
      sync - synchronous invocation?
      lock - the lock which is currently acquired