Registry / utility / resilience4j-timelimiter

resilience4j-timelimiter

JSON →
library2.4.0javamavenunverified

Resilience4j TimeLimiter is a lightweight fault tolerance module for limiting the duration of calls in Java 8+ applications.

<dependency> <groupId>io.github.resilience4j</groupId> <artifactId>resilience4j-timelimiter</artifactId> <version>2.4.0</version> </dependency>
INSTALL
IMPORT
SIG · RESILIENCE4J-TIMEL
R
resilience4j-timelimiter
utilityjavav2.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TimeLimiter
io.github.resilience4j.timelimiter.TimeLimiter

Create a TimeLimiter with a 2-second timeout and execute a future supplier.

import io.github.resilience4j.timelimiter.TimeLimiter; import io.github.resilience4j.timelimiter.TimeLimiterConfig; import java.time.Duration; import java.util.concurrent.CompletableFuture; TimeLimiterConfig config = TimeLimiterConfig.custom() .timeoutDuration(Duration.ofSeconds(2)) .build(); TimeLimiter timeLimiter = TimeLimiter.of(config); CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> { // Simulate long operation return "Result"; }); String result = timeLimiter.executeFutureSupplier(() -> future);
Debug
Known issues
gotchaTimeLimiter requires a CompletableFuture; it does not work with plain Callable or Runnable.
fix
Wrap synchronous calls in CompletableFuture.supplyAsync() before using TimeLimiter.
affects: *
Upgrade
Version history
2.4.0latest on Maven
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
resilience4j-timelimiter — mvn dependency:get resilience4j-timelimiter · libregistry