ExecutorService 接口继承了 Executor 接口,是 Executor 的子接口。

Executor 接口定义了 execute()方法用来接收一个Runnable接口的对象,而 ExecutorService 接口中的 submit()方法可以接受RunnableCallable接口的对象。

Executor 中的 execute() 方法不返回任何结果,而 ExecutorService 中的 submit()方法可以通过一个 Future 对象返回运算结果。

ExecutorService 提供用来控制线程池的方法。比如:调用 shutDown() 方法终止线程池。

补充:Executors执行者工具类,大部分执行者的实例以及线程池都由它的工厂方法创建。

Executor与ExecutorService的更多相关文章

  1. Java再学习——Executor,ExecutorService,ScheduledExecutorService与Executors

    1,Executor.ExecutorService和ScheduledExecutorService,它们都是接口,它们的关系是ScheduledExecutorService继承ExecutorS ...

  2. Java多线程之Executor、ExecutorService、Executors、Callable、Future与FutureTask

    1. 引子 初学Java多线程,常使用Thread与Runnable创建.启动线程.如下例: Thread t1 = new Thread(new Runnable() { @Override pub ...

  3. 多线程——Executor、ExecutorService、Executors三者的区别

    Executor.ExecutorService.Executors三者的区别: 层次关系: public interface ExecutorService extends Executor {} ...

  4. Executor , ExecutorService 和 Executors

    三者的主要区别和关系如下: Executor 和 ExecutorService 这两个接口主要的区别是:ExecutorService 接口继承了 Executor 接口,是 Executor 的子 ...

  5. java中Executor、ExecutorService、ThreadPoolExecutor介绍(转)

    1.Excutor 源码非常简单,只有一个execute(Runnable command)回调接口 public interface Executor { /**     * Executes th ...

  6. Java多线程学习笔记(二)——Executor,Executors,ExecutorService比较

    Executor:是Java线程池的超级接口:提供一个execute(Runnable command)方法;我们一般用它的继承接口ExecutorService. Executors:是java.u ...

  7. Executor框架(二)Executor 与 ExecutorService两个基本接口

    一.Executor 接口简介 Executor接口是Executor框架的一个最基本的接口,Executor框架的大部分类都直接或间接地实现了此接口. 只有一个方法 void execute(Run ...

  8. Executor、ExecutorService、ThreadPoolExecutor

    1.Executor Executor接口中中只有一个方法 执行已提交的Runnable任务对象. ExecutorService pool1 = Executors.newFixedThreadPo ...

  9. java线程池相关接口Executor和ExecutorService

    在线程池的api中,Executor接口是最上层的接口,内部只有一个方法.如下: public interface Executor { void execute(Runnable command); ...

随机推荐

  1. alter system archive log current作用及和alter system switch logfile区别

    alter system archive log current 是归档当前的重做日志文件,不管自动归档有没有打都归档. alter system switch logfile 是强制日志切换,不一定 ...

  2. mybatis Condition查询

    Condition condition = new Condition(ACurrentTotal.class); condition.createCriteria().andCondition(&q ...

  3. DOM中offsetLeft与style.left的区别

    offsetLeft 获取的是相对于父对象的左边距 left 获取或设置相对于 具有定位属性(position定义为relative)的父对象 的左边距 如果父div的position定义为relat ...

  4. [工作日志]2018-11-15 主要: 改bug

    map不能直接转string格式 *方法: Map<String,Object> map=new HashMap<String,Object>(); map.put(" ...

  5. 【webdriver自动化】使用数据驱动的方式实现登录多个163账号

    练习1:使用数据驱动的方式,登录多个邮箱账号 login_info.txt: youxiang_99@163.com,XXXX youxiang_100@163.com,XXXX main.py: f ...

  6. [转]Deep Reinforcement Learning Based Trading Application at JP Morgan Chase

    Deep Reinforcement Learning Based Trading Application at JP Morgan Chase https://medium.com/@ranko.m ...

  7. AMAZON数据集

    http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/

  8. 【转载】 Caffe BN+Scale层和Pytorch BN层的对比

    原文地址: https://blog.csdn.net/elysion122/article/details/79628587 ------------------------------------ ...

  9. Javascript class获取回调函数数据

    /********************************************************************** * Javascript class获取回调函数数据 * ...

  10. supervisor-program配置

    [program:check_server_state]directory=/sunlight/shellcommand=/usr/bin/sh check_server_state.shautost ...