Spring / Resilience4j Interview questions
What is the difference between TimeLimiter and a plain timeout?
A plain, hand-written timeout - like calling future.get(5, TimeUnit.SECONDS) directly - throws when the deadline passes, but the underlying task usually keeps running on its own thread unless something else explicitly cancels it, which can silently leak resources over time.
Resilience4j's TimeLimiter standardizes this into a reusable, named, configurable component with an onSuccess/onError event publisher, and critically offers a cancelRunningFuture option that actively cancels the underlying future once the timeout fires, rather than leaving it to complete unattended.
It also composes with the Decorators API alongside CircuitBreaker, Retry, and Bulkhead, so a timeout becomes just one more layer in a consistent resilience pipeline instead of a one-off piece of custom code that behaves differently from the rest of the call chain.
More Related questions...