org.jboss.cache.util
Class ThreadGate

java.lang.Object
  extended by org.jboss.cache.util.ThreadGate

public class ThreadGate
extends Object

A reclosable gate with timeout support.

Author:
Jason T. Greene

Constructor Summary
ThreadGate()
           
 
Method Summary
 void await()
          Waits for the gate to open.
 boolean await(long time)
          Waits for the gate to open or the specified time to elapse.
 void close()
          Close the gate.
 void open()
          Open the gate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadGate

public ThreadGate()
Method Detail

open

public void open()
Open the gate.


close

public void close()
Close the gate.


await

public void await()
           throws InterruptedException
Waits for the gate to open.

Throws:
InterruptedException - if this thread is interrupted

await

public boolean await(long time)
              throws InterruptedException
Waits for the gate to open or the specified time to elapse.

Parameters:
time - the maximum time in milliseconds to wait.
Returns:
false if gate timeout occurred
Throws:
InterruptedException - if this thread is interrupted


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.