Package io.temporal.worker.tuning
Class SlotSupplierFuture
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<SlotPermit>
-
- io.temporal.worker.tuning.SlotSupplierFuture
-
- All Implemented Interfaces:
java.util.concurrent.CompletionStage<SlotPermit>,java.util.concurrent.Future<SlotPermit>
public abstract class SlotSupplierFuture extends java.util.concurrent.CompletableFuture<SlotPermit>
Represents a future that will be completed with aSlotPermitwhen a slot is available.This class exists to provide a reliable cancellation mechanism, since
CompletableFuturedoes not provide cancellations that properly propagate up the chain.
-
-
Constructor Summary
Constructors Constructor Description SlotSupplierFuture()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract SlotPermitabortReservation()Abort the reservation attempt.booleancancel(boolean mayInterruptIfRunning)static SlotSupplierFuturecompletedFuture(SlotPermit permit)SeeCompletableFuture.completedFuture(Object)static SlotSupplierFuturefromCompletableFuture(java.util.concurrent.CompletableFuture<SlotPermit> future, java.lang.Runnable abortHandler)Create a newSlotSupplierFuturefrom aCompletableFuture-
Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, complete, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsync
-
-
-
-
Method Detail
-
abortReservation
@Nullable @CheckReturnValue public abstract SlotPermit abortReservation()
Abort the reservation attempt. Direct implementations should cancel or interrupt any underlying processes that are attempting to reserve a slot.
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancelin interfacejava.util.concurrent.Future<SlotPermit>- Overrides:
cancelin classjava.util.concurrent.CompletableFuture<SlotPermit>
-
completedFuture
public static SlotSupplierFuture completedFuture(SlotPermit permit)
SeeCompletableFuture.completedFuture(Object)
-
fromCompletableFuture
public static SlotSupplierFuture fromCompletableFuture(java.util.concurrent.CompletableFuture<SlotPermit> future, java.lang.Runnable abortHandler)
Create a newSlotSupplierFuturefrom aCompletableFuture- Parameters:
abortHandler- The handler to call when the reservation is aborted. This should abort the furthest-upstream future, or call being waited on, in order to properly propagate cancellation downstream.
-
-