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

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

There is a newer version: 0.13.7
Show newest version
package ru.tinkoff.kora.resilient.timeout;

import javax.annotation.Nonnull;
import java.time.Duration;
import java.util.concurrent.Callable;

/**
 * Timeout executor contract
 */
public interface Timeouter {

    /**
     * @return duration timeout executor is configured for
     */
    @Nonnull
    Duration timeout();

    /**
     * @param runnable to execute
     * @throws TimeoutException when timed out
     */
    void execute(@Nonnull Runnable runnable) throws TimeoutException;

    /**
     * @param supplier to execute
     * @throws TimeoutException when timed out
     */
     T execute(@Nonnull Callable supplier) throws TimeoutException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy