Class DefaultTimeoutFutureResolver
java.lang.Object
io.axoniq.framework.workflow.runtime.util.DefaultTimeoutFutureResolver
- All Implemented Interfaces:
FutureResolver
Default
FutureResolver that applies a 30-second safety-net timeout to future resolution.
Thirty seconds is long enough for legitimate synchronous workflow work, including in-memory, local database, and unit-of-work execution. It is short enough to surface a hung dependency, such as connection-pool exhaustion, deadlock, or network partition, before blocked workflow threads cascade into a broader outage. Callers that legitimately expect a longer wait must configure it explicitly.
- Since:
- 5.4.0
- Author:
- Simon Zambrovski
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationDefault safety-net timeout for joining a future. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a with a default timeout.DefaultTimeoutFutureResolver(Duration timeout) Constructs a with the given timeout. -
Method Summary
Modifier and TypeMethodDescriptionvoidresolve(CompletableFuture<?> future) Waits for the future until it completes or the configured timeout elapses, whichever comes first.
-
Field Details
-
DEFAULT_JOIN_TIMEOUT
Default safety-net timeout for joining a future.
-
-
Constructor Details
-
DefaultTimeoutFutureResolver
public DefaultTimeoutFutureResolver()Constructs a with a default timeout. -
DefaultTimeoutFutureResolver
Constructs a with the given timeout.- Parameters:
timeout- timeout to use for future joining
-
-
Method Details
-
resolve
Waits for the future until it completes or the configured timeout elapses, whichever comes first.Delegates to
FutureUtils.joinAndUnwrap(CompletableFuture, Duration). A completed future does not incur timeout work, exceptional completion is rethrown as its original cause, and timeout expiry throwsFutureResolutionTimeoutException. The timeout is applied to a copy so it cannot complete the original asynchronous operation exceptionally.- Specified by:
resolvein interfaceFutureResolver- Parameters:
future- future to resolve- Throws:
FutureResolutionTimeoutException- if the future does not complete within the configured timeoutThrowable- the unwrapped cause if the future completed exceptionally (exact type preserved).
-