Package org.infinispan.util.concurrent
Class NonBlockingManagerImpl
java.lang.Object
org.infinispan.util.concurrent.NonBlockingManagerImpl
- All Implemented Interfaces:
NonBlockingManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Scheduler
Returns a scheduler to be used with RxJavaFlowable.observeOn(Scheduler)
method or similar.<T> void
complete
(CompletableFuture<? super T> future, T value) Completes the provided future with the given value.void
completeExceptionally
(CompletableFuture<?> future, Throwable t) Exceptionally completes the provided future with the given throble.scheduleWithFixedDelay
(Supplier<CompletionStage<?>> supplier, long initialDelay, long delay, TimeUnit unit, Predicate<? super Throwable> mayRepeatOnThrowable) Schedules the supplier that is executed after the initialDelay period and subsequently runs delay after the previous stage completes.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.infinispan.util.concurrent.NonBlockingManager
scheduleWithFixedDelay
-
Constructor Details
-
NonBlockingManagerImpl
public NonBlockingManagerImpl()
-
-
Method Details
-
scheduleWithFixedDelay
public AutoCloseable scheduleWithFixedDelay(Supplier<CompletionStage<?>> supplier, long initialDelay, long delay, TimeUnit unit, Predicate<? super Throwable> mayRepeatOnThrowable) Description copied from interface:NonBlockingManager
Schedules the supplier that is executed after the initialDelay period and subsequently runs delay after the previous stage completes. The supplier must not block the thread in which it runs and should immediately return to avoid blocking the scheduling thread.This supplier method will not be rescheduled if the supplier throws any Throwable directly. If the CompletionStage returned from the supplier produces a Throwable, it is possible to reschedule the supplier if the given Throwable passes the mayRepeatOnThrowable predicate.
- Specified by:
scheduleWithFixedDelay
in interfaceNonBlockingManager
- Parameters:
supplier
- non-blocking operation supplier.initialDelay
- period of time before the supplier is invoked.delay
- delay between subsequent supplier invocations.unit
- time unit for delays.mayRepeatOnThrowable
- whether to continue scheduling if the provided supplier returns a Throwable- Returns:
- an AutoCloseable that cancels the scheduled task.
-
complete
Description copied from interface:NonBlockingManager
Completes the provided future with the given value. If the future does not have any dependents it will complete it in the invoking thread. However, if there are any dependents it will complete it in a non blocking thread. This is a best effort to prevent a context switch for a stage that does not yet have a dependent while also handing off the dependent processing to a non blocking thread if necessary.- Specified by:
complete
in interfaceNonBlockingManager
- Type Parameters:
T
- the type of the value- Parameters:
future
- the future to completevalue
- the value to complete the future with
-
completeExceptionally
Description copied from interface:NonBlockingManager
Exceptionally completes the provided future with the given throble. If the future does not have any dependents it will complete it in the invoking thread. However, if there are any dependents it will complete it in a non blocking thread. This is a best effort to prevent a context switch for a stage that does not yet have a dependent while also handing off the dependent processing to a non blocking thread if necessary.- Specified by:
completeExceptionally
in interfaceNonBlockingManager
- Parameters:
future
- future to completet
- throwable to complete the future with
-
asScheduler
public io.reactivex.rxjava3.core.Scheduler asScheduler()Description copied from interface:NonBlockingManager
Returns a scheduler to be used with RxJavaFlowable.observeOn(Scheduler)
method or similar.- Specified by:
asScheduler
in interfaceNonBlockingManager
- Returns:
- schduler to use within the RxJava ecosystem
-