Package edu.byu.hbll.box.internal.core
Class OnOffSemaphore
- java.lang.Object
-
- edu.byu.hbll.box.internal.core.OnOffSemaphore
-
public class OnOffSemaphore extends Object
A semaphore to answer whether processing is turned on or not at the moment.
-
-
Constructor Summary
Constructors Constructor Description OnOffSemaphore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitOn(long timeout, TimeUnit unit)
Blocks until processing is turned back on throughsetOn(boolean)
or until the timeout occurs.boolean
isOn()
Returns whether or not processing is on.
-
-
-
Method Detail
-
isOn
public boolean isOn()
Returns whether or not processing is on.- Returns:
- whether or not processing is on
-
awaitOn
public boolean awaitOn(long timeout, TimeUnit unit) throws InterruptedException
Blocks until processing is turned back on throughsetOn(boolean)
or until the timeout occurs.- Parameters:
timeout
- the time to waitunit
- the unit of time- Returns:
- if on after wait
- Throws:
InterruptedException
- if interrupted
-
-