Package org.infinispan.util.concurrent
Class ConditionFuture<T>
- java.lang.Object
-
- org.infinispan.util.concurrent.ConditionFuture<T>
-
public class ConditionFuture<T> extends Object
A mixture between aCompletableFutureand aCondition.- Since:
- 10.1
- Author:
- Dan Berindei
-
-
Constructor Summary
Constructors Constructor Description ConditionFuture(ScheduledExecutorService timeoutExecutor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>newConditionStage(Predicate<T> test, long timeout, TimeUnit timeUnit)Create a newCompletionStagethat completes after the firstupdate(Object)call with a value satisfying thetestpredicate.voidstop()voidupdate(T value)Update the value and complete any outstanding condition stages for which the value satisfies the predicate.voidupdateAsync(T value, Executor executor)Update the value and complete any outstanding condition stages for which the value satisfies the predicate.
-
-
-
Constructor Detail
-
ConditionFuture
public ConditionFuture(ScheduledExecutorService timeoutExecutor)
-
-
Method Detail
-
newConditionStage
public CompletionStage<Void> newConditionStage(Predicate<T> test, long timeout, TimeUnit timeUnit)
Create a newCompletionStagethat completes after the firstupdate(Object)call with a value satisfying thetestpredicate.- Parameters:
test- The predicate.timeout- Maximum time to wait for a value satisfying the predicate.timeUnit- Timeout time unit.
-
update
public void update(T value)
Update the value and complete any outstanding condition stages for which the value satisfies the predicate.
-
updateAsync
public void updateAsync(T value, Executor executor)
Update the value and complete any outstanding condition stages for which the value satisfies the predicate.
-
stop
public void stop()
-
-