1、线程池的顶级接口(Executor)

线程池的顶级接口(jdk > 1.5)。仅仅定义了方法execute(Runnable)。

该方法接收一个Runnable实例,用来执行一个任务,该任务即是一个实现Runnable接口的类。

 

public interface Executor {

    /**
     * Executes the given command at some time in the future.  The command
     * may execute in a new thread, in a pooled thread, or in the calling
     * thread, at the discretion of the <tt>Executor</tt> implementation.
     *
     * @param command the runnable task
     * @throws RejectedExecutionException if this task cannot be
     * accepted for execution.
     * @throws NullPointerException if command is null
     */
    void execute(Runnable command);
}
View Code

相关文章:

  • 2022-03-04
  • 2022-01-22
  • 2021-05-12
  • 2021-07-22
  • 2021-12-15
  • 2021-08-12
  • 2021-08-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2021-10-15
  • 2022-12-23
  • 2021-06-13
  • 2022-02-06
相关资源
相似解决方案