Interface TimeoutService

  • All Known Implementing Classes:
    DefaultTimeoutService

    public interface TimeoutService
    The TimeoutService provides a convenient way to execute some logic within a given period of time.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <V> V execute​(@NotNull java.util.concurrent.Callable<V> callable, @javax.validation.constraints.PositiveOrZero long timeout)
      Executes the Callable and wait until the timeout period expires.
    • Method Detail

      • execute

        <V> V execute​(@NotNull
                      @NotNull java.util.concurrent.Callable<V> callable,
                      @PositiveOrZero
                      @javax.validation.constraints.PositiveOrZero long timeout)
        Executes the Callable and wait until the timeout period expires. When the timeout occurred the implementation may decide to return a value indicating so, or an exception is thrown.
        Type Parameters:
        V - The type of the return value from the Callable
        Parameters:
        callable - The logic to execute
        timeout - The period to wait for the execution to complete. Negative value should result in an IntegrationTimeoutException. The implementation can decide what to do with 0. It can throw an IntegrationTimeoutException, or equate 0 to wait indefinitely.
        Returns:
        The value returned from the Callable