翻译javadoc系列文章之:ExecutorService

/**

* An {@link Executor} that provides methods to manage termination and

* methods that can produce a {@link Future} for tracking progress of

* one or more asynchronous tasks.

*

* <p> An <tt>ExecutorService</tt> can be shut down, which will cause

* it to reject new tasks.  Two different methods are provided for

* shutting down an <tt>ExecutorService</tt>. The {@link #shutdown}

* method will allow previously submitted tasks to execute before

* terminating, while the {@link #shutdownNow} method prevents waiting

* tasks from starting and attempts to stop currently executing tasks.

* Upon termination, an executor has no tasks actively executing, no

* tasks awaiting execution, and no new tasks can be submitted.  An

* unused <tt>ExecutorService</tt> should be shut down to allow

* reclamation of its resources.

*

* <p> Method <tt>submit</tt> extends base method {@link

* Executor#execute} by creating and returning a {@link Future} that

* can be used to cancel execution and/or wait for completion.

* Methods <tt>invokeAny</tt> and <tt>invokeAll</tt> perform the most

* commonly useful forms of bulk execution, executing a collection of

* tasks and then waiting for at least one, or all, to

* complete. (Class {@link ExecutorCompletionService} can be used to

* write customized variants of these methods.)

*

* <p>The {@link Executors} class provides factory methods for the

* executor services provided in this package.

ExecutorService 接口是一个提供管理终止(termination)和能够生成跟踪一个或多个异步任务进程结果的方法的接口。

介绍ExecutorService接口的功能:

  1:提供管理终止功能(拒绝新任务进入功能);

  2:提供方法来生成能够追踪一个或多个任务执行结果的Future;

一个ExecutorService可以被关闭,即使其拒绝接受新的任务。

它提供了两种不同的方法来关闭一个ExecutorService。

方法1(shutdown方法):允许之前已经提交的任务继续执行到结束。

方法2(shutdownNow方法):会阻止等待开始的

已经有人翻译了:http://josh-persistence.iteye.com/blog/2145120

可以参考一下;

Java基础之-ExecutorService的更多相关文章

  1. 【Java基础】ExecutorService的使用

    ExecutorService是java中的一个异步执行的框架,通过使用ExecutorService可以方便的创建多线程执行环境. 本文将会详细的讲解ExecutorService的具体使用. 创建 ...

  2. Java基础学习笔记: 多线程,线程池,同步锁(Lock,synchronized )(Thread类,ExecutorService ,Future类)(卖火车票案例)

    多线程介绍 学习多线程之前,我们先要了解几个关于多线程有关的概念.进程:进程指正在运行的程序.确切的来说,当一个程序进入内存运行,即变成一个进程,进程是处于运行过程中的程序,并且具有一定独立功能. 线 ...

  3. [Java 基础] 并发队列ConcurrentLinkedQueue和阻塞队列LinkedBlockingQueue用法

    reference : http://www.cnblogs.com/linjiqin/archive/2013/05/30/3108188.html 在Java多线程应用中,队列的使用率很高,多数生 ...

  4. JAVA基础知识之网络编程——-网络基础(Java的http get和post请求,多线程下载)

    本文主要介绍java.net下为网络编程提供的一些基础包,InetAddress代表一个IP协议对象,可以用来获取IP地址,Host name之类的信息.URL和URLConnect可以用来访问web ...

  5. 【java基础之jdk源码】Object

    最新在整体回归下java基础薄弱环节,以下为自己整理笔记,若有理解错误,请批评指正,谢谢. java.lang.Object为java所有类的基类,所以一般的类都可用重写或直接使用Object下方法, ...

  6. JAVA基础再回首(二十五)——Lock锁的使用、死锁问题、多线程生产者和消费者、线程池、匿名内部类使用多线程、定时器、面试题

    JAVA基础再回首(二十五)--Lock锁的使用.死锁问题.多线程生产者和消费者.线程池.匿名内部类使用多线程.定时器.面试题 版权声明:转载必须注明本文转自程序猿杜鹏程的博客:http://blog ...

  7. JAVA基础经典面试

    [前言] 整理好久,这篇总结写的超级好,很全面.要全部背下来,至于框架应用那块,一定要有针对的,多写项目,照着慕课的对应项目. 链接:http://www.importnew.com/22083.ht ...

  8. java基础常见面试题,这是一篇超长的随笔!!!

    1. Java基础部分....................................................... 4 1.一个".java"源文件中是否可以包括 ...

  9. JAVA面试精选【Java基础第二部分】

    上一篇,我们给出了大概35个题目,都是基础知识,有童鞋反映题目过时了,其实不然,这些是基础中的基础,但是也是必不可少的,面试题目中还是有一些基础题目的,我们本着先易后难的原则,逐渐给出不同级别的题目, ...

  10. Java基础-进程与线程之Thread类详解

    Java基础-进程与线程之Thread类详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.进程与线程的区别 简而言之:一个程序运行后至少有一个进程,一个进程中可以包含多个线程 ...

随机推荐

  1. urlencode 和 rawurlencode 的区别

    urlencode和rawurlencode的区别urlencode和rawurlencode的区别 $str1 = urlencode(':/?= &#'); $str2 = rawurle ...

  2. Caché数据库学习笔记(2)

    目录: 创建新类(表)(class文件)与创建routine(.mac  .inc) 在类里面添加函数(classmethod) Terminal的使用 ======================= ...

  3. Windows C++ 子目录数量

    CFileFind OneFile; BOOL bWorking = FALSE; ; ) != "\\") { strPath += "\\*.*"; } b ...

  4. zookeeper学习系列:三、利用zookeeper做选举和锁

    之前只理解zk可以做命名,配置服务,现在学习下他怎么用作选举和锁,进一步还可构建master-slave模式的分布式系统. 为什么叫Zoo?“因为要协调的分布式系统是一个动物园”. ZooKeeper ...

  5. CodeForces #367 div2 D Trie

    题目链接:Vasiliy's Multiset 题意:这里有一个set容器,有三种操作,+ num, - num, ? num,分别代表往容器里加上num,或者拿走num,或着从容器里找一个数temp ...

  6. android单选框和复选框(练习)

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

  7. web前端基础篇⑥

    LESS.①是一种拓展技术,基于css.②包含变量.混合.函数.运算.③简化css代码.降低维护成本④目前用的解析器(koala) 变量(值可变)@变量名:值步骤:①建立文件夹②建html和less两 ...

  8. 关于QGraphicsScene 和 QGraphicsView 和 QDialog 的杂乱笔记【或说指针复习。。】

    LtCalibrateDlg::~LtCalibrateDlg() { if (m_pIplImageGray) cvReleaseImage(&m_pIplImageGray); MYDEL ...

  9. cocos2dx 3.8版关于#include "GB2ShapeCache-x.h"

    关于coco2d-x 3.8版的PhysicsEditor.exe1.09版的GB2ShapeCache-x.h.cpp中有些方法更新了和容器的使用方法,还有就是头文件include "CC ...

  10. BZOJ 2763 分层图最短路

    突然发现我不会分层图最短路,写一发. 就是同层中用双向边相连,用单向边连下一层 #include <cstdio> #include <algorithm> #include ...