java Executor 和 ExecutorService 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15052317/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 18:19:56  来源:igfitidea点击:

what's the difference between Executor and ExecutorService?

java

提问by Adam Lee

I am wondering what's the difference between Executor and ExecutorService?

我想知道 Executor 和 ExecutorService 有什么区别?

Any example will help.

任何例子都会有所帮助。

回答by radai

Executorjust executes stuff you give it.

Executor只是执行你给它的东西。

ExecutorServiceadds startup, shutdown, and the ability to wait for and look at the status of jobs you've submitted for execution on top of Executor (which it extends).

ExecutorService添加了启动、关闭以及等待和查看您已提交以在 Executor 之上执行的作业状态的能力(它扩展了它)。