All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.tinkoff.kora.resilient.timeout.Timeout Maven / Gradle / Ivy

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;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy