Class CallableWithTimeout

java.lang.Object
fr.inria.rules.integraal.util.timeout.CallableWithTimeout

public class CallableWithTimeout extends Object
A utility class to execute a Callable with a specified timeout. If the timeout expires before the Callable completes, it returns null.
  • Constructor Details

    • CallableWithTimeout

      public CallableWithTimeout()
      Creates the timeout helper utility.
  • Method Details

    • execute

      public static <T> T execute(Callable<T> task, Duration timeout)
      Executes a Callable with a specified timeout.
      Type Parameters:
      T - The result type returned by the callable.
      Parameters:
      task - The Callable to execute.
      timeout - The duration of the timeout ; must not be null;
      Returns:
      The result of the Callable, or null if the timeout expires.