org.springframework.core.task

Interface AsyncTaskExecutor

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static long TIMEOUT_IMMEDIATE
      Constant that indicates immediate execution.
      static long TIMEOUT_INDEFINITE
      Constant that indicates no time limit.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void execute(java.lang.Runnable task, long startTimeout)
      Execute the given task.
      <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
      Submit a Callable task for execution, receiving a Future representing that task.
      java.util.concurrent.Future<?> submit(java.lang.Runnable task)
      Submit a Runnable task for execution, receiving a Future representing that task.
    • Field Detail

      • TIMEOUT_IMMEDIATE

        static final long TIMEOUT_IMMEDIATE
        Constant that indicates immediate execution.
        See Also:
        Constant Field Values
      • TIMEOUT_INDEFINITE

        static final long TIMEOUT_INDEFINITE
        Constant that indicates no time limit.
        See Also:
        Constant Field Values
    • Method Detail

      • execute

        void execute(java.lang.Runnable task,
                     long startTimeout)
        Execute the given task.
        Parameters:
        task - the Runnable to execute (never null)
        startTimeout - the time duration (milliseconds) within which the task is supposed to start. This is intended as a hint to the executor, allowing for preferred handling of immediate tasks. Typical values are TIMEOUT_IMMEDIATE or TIMEOUT_INDEFINITE (the default as used by TaskExecutor.execute(Runnable)).
        Throws:
        TaskTimeoutException - in case of the task being rejected because of the timeout (i.e. it cannot be started in time)
        TaskRejectedException - if the given task was not accepted
      • submit

        java.util.concurrent.Future<?> submit(java.lang.Runnable task)
        Submit a Runnable task for execution, receiving a Future representing that task. The Future will return a null result upon completion.
        Parameters:
        task - the Runnable to execute (never null)
        Returns:
        a Future representing pending completion of the task
        Throws:
        TaskRejectedException - if the given task was not accepted
        Since:
        3.0
      • submit

        <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
        Submit a Callable task for execution, receiving a Future representing that task. The Future will return the Callable's result upon completion.
        Parameters:
        task - the Callable to execute (never null)
        Returns:
        a Future representing pending completion of the task
        Throws:
        TaskRejectedException - if the given task was not accepted
        Since:
        3.0