Package org.jgroups.util
Class CondVar
- java.lang.Object
-
- org.jgroups.util.CondVar
-
public class CondVar extends java.lang.Object
A condition variable with methods for (timed) waiting and signalling- Since:
- 3.6
- Author:
- Bela Ban
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
signal(boolean signal_all)
Wakes up one (signal_all=false) or all (signal_all=true) blocked threads.void
waitFor(java.util.function.BooleanSupplier condition)
Blocks until condition is true.boolean
waitFor(java.util.function.BooleanSupplier condition, long timeout, java.util.concurrent.TimeUnit unit)
Blocks until condition is true or the time elapsed
-
-
-
Method Detail
-
waitFor
public void waitFor(java.util.function.BooleanSupplier condition)
Blocks until condition is true.- Parameters:
condition
- The condition. Must be non-null
-
waitFor
public boolean waitFor(java.util.function.BooleanSupplier condition, long timeout, java.util.concurrent.TimeUnit unit)
Blocks until condition is true or the time elapsed- Parameters:
condition
- The conditiontimeout
- The timeout to wait. A value <= 0 causes immediate returnunit
- TimeUnit- Returns:
- The condition's status
-
signal
public void signal(boolean signal_all)
Wakes up one (signal_all=false) or all (signal_all=true) blocked threads. Usually called when the condition changed to true.- Parameters:
signal_all
-
-
-