ix.util
Class ThreadCondition

java.lang.Object
  extended by ix.util.ThreadCondition
All Implemented Interfaces:
java.lang.Comparable

public class ThreadCondition
extends java.lang.Object
implements java.lang.Comparable

Handles waiting for a condition to be made true by another thread. ThreadConditions are Comparable so that threads waiting for more than one condition can test them in a standard order.


Field Summary
protected static int count
           
protected  boolean isTrue
           
protected  java.lang.String name
           
protected  int number
           
 
Constructor Summary
ThreadCondition()
           
ThreadCondition(java.lang.String name)
           
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean isTrue()
           
 void setFalse()
           
 void setTrue()
           
 java.lang.String toString()
           
 void waitUntilTrue()
           
 void waitUntilTrue(long timeout)
          Wait with a timout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

isTrue

protected boolean isTrue

number

protected int number

count

protected static int count
Constructor Detail

ThreadCondition

public ThreadCondition()

ThreadCondition

public ThreadCondition(java.lang.String name)
Method Detail

setTrue

public void setTrue()

setFalse

public void setFalse()

isTrue

public boolean isTrue()

waitUntilTrue

public void waitUntilTrue()

waitUntilTrue

public void waitUntilTrue(long timeout)
Wait with a timout.

Parameters:
timeout - time limit, in milliseconds

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object