1 package locklib;
2
3 /**
4 * A lock pre-checker is informed of all locks currently held and decides
5 * whether a lock (which cannot be obtained right now) can be queued for
6 * later acquisition. The most common use of a pre-checker is to detect
7 * deadlocks.
8 * @param <LockType> the type of lock
9 */
10 public interface LockPreChecker<LockType>
11 extends LockManagerListener<LockType> {
12 /**
13 * Checks if we can wait for a lock. This method should throw an exception
14 * if waiting for the lock is not allowed.
15 * @param r the lock request
16 * @param t the lock target
17 */
18 void pre_check_wait(LockRequest<LockType> r, Target<LockType> t);
19 }