接口 AsyncTaskExecutor

    • 方法详细资料

      • execute

        void execute​(Runnable task,
                     long startTimeout)
        Execute the given task.
        参数:
        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)).
        抛出:
        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

        Future<?> submit​(Runnable task)
        Submit a Runnable task for execution, receiving a Future representing that task. The Future will return a null result upon completion.
        参数:
        task - the Runnable to execute (never null)
        返回:
        a Future representing pending completion of the task
        抛出:
        TaskRejectedException - if the given task was not accepted
        从以下版本开始:
        3.0
      • submit

        <T> Future<T> submit​(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.
        参数:
        task - the Callable to execute (never null)
        返回:
        a Future representing pending completion of the task
        抛出:
        TaskRejectedException - if the given task was not accepted
        从以下版本开始:
        3.0