org.norther.tammi.acorn.util.concurrent
Class Latch

java.lang.Object
  extended by org.norther.tammi.acorn.util.concurrent.Latch
All Implemented Interfaces:
Serializable, Lock

public class Latch
extends Object
implements Lock, Serializable

A latch is a boolean condition that is set at most once, ever. Once a single release is issued, all acquires will pass.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
Latch()
           
 
Method Summary
 void lock()
           
 void lockInterruptibly()
           
 Condition newCondition()
           
 boolean tryLock()
           
 boolean tryLock(long time, TimeUnit unit)
           
 void unlock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Latch

public Latch()
Method Detail

lock

public void lock()
Specified by:
lock in interface Lock

lockInterruptibly

public void lockInterruptibly()
                       throws InterruptedException
Specified by:
lockInterruptibly in interface Lock
Throws:
InterruptedException

tryLock

public boolean tryLock()
Specified by:
tryLock in interface Lock

tryLock

public boolean tryLock(long time,
                       TimeUnit unit)
                throws InterruptedException
Specified by:
tryLock in interface Lock
Throws:
InterruptedException

unlock

public void unlock()
Specified by:
unlock in interface Lock

newCondition

public Condition newCondition()
Specified by:
newCondition in interface Lock


Copyright © 2004 The Norther Organization. All rights reserved.