public LockResult lock ( final TaskLockType lockType , final Task task , final Interval interval ) throws InterruptedException { giant . lockInterruptibly ( ) ; try { LockResult lockResult ; while ( ! ( lockResult = tryLock ( lockType , task , interval ) ) . isOk ( ) ) { if ( lockResult . isRevoked ( ) ) { return lockResult ; } lockReleaseCondition . await ( ) ; } return lockResult ; } finally { giant . unlock ( ) ; } }
Acquires a lock on behalf of a task . Blocks until the lock is acquired .