de.fhg.igd.util.concurrent
Interface BooleanLock

All Superinterfaces:
Serializable
All Known Implementing Classes:
TransitionDetector

public interface BooleanLock
extends Serializable

This utility can be used to provide an interruptible technique for providing exclusive access to a block of code. It provides a encapsulation of a boolean variable that is easily and safely accessed from multible threads. These threads can set and test the internal value and wait for it to change. The wait/notify mechanism is used internally to support waiting for the value to change, and frees extrenal classes from the errorprone complexity of properly implementing this mechanism.

Version:
"$Id: BooleanLock.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Jan Haevecker

Method Summary
 boolean isFalse()
           
 boolean isTrue()
           
 void setValue(boolean value)
           
 void waitForFalse()
           
 void waitForTrue()
           
 

Method Detail

waitForTrue

void waitForTrue()
                 throws InterruptedException
Throws:
InterruptedException

waitForFalse

void waitForFalse()
                  throws InterruptedException
Throws:
InterruptedException

setValue

void setValue(boolean value)

isTrue

boolean isTrue()

isFalse

boolean isFalse()


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.