Java micro-library for writing & testing concurrent code


The Timeout class takes a Duration representing a period after which a timeout has occurred. The timeout status of the object is checked using the hasExpired method. Note that the timeout uses a StopWatch internally and that the stop watch is started on construction.

Timeout class is combined with a Condition to implement the waitUntil method of WaitFor which waits until a timeout expires rather than for a condition to be met.

Next, Testing Time Sensitive Code: Testing with the Clock Interface »