Class ResilienceConfiguration.TimeLimiterConfiguration
java.lang.Object
com.sap.cloud.sdk.cloudplatform.resilience.ResilienceConfiguration.TimeLimiterConfiguration
- Enclosing class:
- ResilienceConfiguration
Provides options specific to timeouts.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
The default behaviour for canceling running tasks.static final Duration
The default timeout duration. -
Method Summary
Modifier and TypeMethodDescriptiondisabled()
Creates a newTimeLimiterConfiguration
that allows for requests to run indefinitely, effectively disabling timeouts.boolean
int
hashCode()
boolean
Get the status indicator for TimeLimiter.of()
Create a timeout by specifying a timeout duration.boolean
Whether to cancel the running future.shouldCancelRunningFuture
(boolean shouldCancelRunningFuture) Whether to cancel the running future.The timeout duration.timeoutDuration
(Duration timeoutDuration) The timeout duration.
-
Field Details
-
DEFAULT_TIMEOUT_DURATION
The default timeout duration. -
DEFAULT_SHOULD_CANCEL_RUNNING_FUTURE
public static final boolean DEFAULT_SHOULD_CANCEL_RUNNING_FUTUREThe default behaviour for canceling running tasks.- See Also:
-
-
Method Details
-
isEnabled
public boolean isEnabled()Get the status indicator for TimeLimiter.- Returns:
- True if the configuration is enabled.
-
disabled
Creates a newTimeLimiterConfiguration
that allows for requests to run indefinitely, effectively disabling timeouts.- Returns:
- A disabled time limiter.
-
of
@Nonnull public static ResilienceConfiguration.TimeLimiterConfiguration of(@Nonnull Duration timeoutDuration) Create a timeout by specifying a timeout duration.
Alternatively useTimeLimiterConfiguration.of().timeoutDuration( int )
instead.- Parameters:
timeoutDuration
- The maximum duration to wait for a request to return.- Returns:
- An immutable
TimeLimiterConfiguration
.
-
of
-
equals
-
hashCode
public int hashCode() -
timeoutDuration
The timeout duration. -
shouldCancelRunningFuture
public boolean shouldCancelRunningFuture()Whether to cancel the running future. -
timeoutDuration
@Nonnull public ResilienceConfiguration.TimeLimiterConfiguration timeoutDuration(@Nonnull Duration timeoutDuration) The timeout duration.- Returns:
this
.
-
shouldCancelRunningFuture
@Nonnull public ResilienceConfiguration.TimeLimiterConfiguration shouldCancelRunningFuture(boolean shouldCancelRunningFuture) Whether to cancel the running future.- Returns:
this
.
-