public class ConditionTrafficLight extends Object implements BooleanSignal
TrafficLight with Condition on JDK5TrafficLight| 构造器和说明 |
|---|
ConditionTrafficLight()
green light is off on default
|
ConditionTrafficLight(boolean isGreen) |
public ConditionTrafficLight()
public ConditionTrafficLight(boolean isGreen)
isGreen - green light is onpublic void setRed()
setRed 在接口中 BooleanSignalpublic void setGreen()
throws InterruptedException
setGreen 在接口中 BooleanSignalInterruptedExceptionpublic void waitGreen()
throws InterruptedException
BooleanSignalwaitGreen 在接口中 BooleanSignalInterruptedException - if any thread interrupted the current thread before or while
the current thread was waiting for a notification. The
interrupted status of the current thread is cleared
when this exception is thrown.public boolean isGreen()
isGreen 在接口中 BooleanSignalCopyright © 2017. All rights reserved.