ru.tinkoff.kora.resilient.timeout.Timeout Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of resilient-kora Show documentation
Show all versions of resilient-kora Show documentation
Kora resilient-kora module
The newest version!
package ru.tinkoff.kora.resilient.timeout;
import jakarta.annotation.Nonnull;
import java.time.Duration;
import java.util.concurrent.Callable;
/**
* Timeout executor contract
*/
public interface Timeout {
/**
* @return duration timeout executor is configured for
*/
@Nonnull
Duration timeout();
/**
* @param runnable to execute
* @throws TimeoutExhaustedException when timed out
*/
void execute(@Nonnull Runnable runnable) throws TimeoutExhaustedException;
/**
* @param supplier to execute
* @throws TimeoutExhaustedException when timed out
*/
T execute(@Nonnull Callable supplier) throws TimeoutExhaustedException;
}