摘自马士兵java并发编程

一、认识Executor、ExecutorService、Callable、Executors

/**
 * 认识Executor
 */
package yxxy.c_026;

import java.util.concurrent.Executor;

public class T01_MyExecutor implements Executor {

    public static void main(String[] args) {
        new T01_MyExecutor().execute(new Runnable(){

            @Override
            public void run() {
                System.out.println("hello executor");
            }
            
        });
    }

    @Override
    public void execute(Runnable command) {
        //new Thread(command).run();
        command.run();
    }

}
View Code

相关文章:

  • 2022-02-14
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-02-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-30
  • 2022-12-23
  • 2022-03-03
  • 2021-08-26
  • 2021-07-23
相关资源
相似解决方案