Interface Lock

All Known Implementing Classes:
ReentrantLock

public interface Lock
java.util.concurrent.locks.Lock, which the class library does not carry.
Since:
1.0.3
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Takes the lock, suspending the caller until it is free.
    void
    Takes the lock, giving up if the caller is interrupted first.
    Returns a condition bound to this lock.
    boolean
    Returns whether the lock was free and has now been taken.
    boolean
    tryLock(long time, TimeUnit unit)
     
    void
    Releases the lock.
  • Method Details

    • lock

      void lock()
      Takes the lock, suspending the caller until it is free.
    • lockInterruptibly

      void lockInterruptibly() throws InterruptedException
      Takes the lock, giving up if the caller is interrupted first.
      Throws:
      InterruptedException - if the caller was interrupted
    • tryLock

      boolean tryLock()
      Returns whether the lock was free and has now been taken.
      Returns:
      whether the lock was free and has now been taken
    • tryLock

      boolean tryLock(long time, TimeUnit unit) throws InterruptedException
      Parameters:
      time - the longest to wait
      unit - the unit of time
      Returns:
      whether the lock was taken in time
      Throws:
      InterruptedException - if the caller was interrupted
    • unlock

      void unlock()
      Releases the lock.
    • newCondition

      Condition newCondition()
      Returns a condition bound to this lock.
      Returns:
      a condition bound to this lock