- 浏览: 121399 次
- 性别:
- 来自: Singapore
文章分类
- 全部博客 (112)
- Tiger Thread (18)
- Perforce (6)
- Spring (5)
- maven (3)
- log4j (3)
- Quartz Scheduler (4)
- unix and linux (12)
- hibernate (3)
- Enum (1)
- Futures and Options (1)
- Market Making (2)
- Java Basic (11)
- Tibco EMS (3)
- F I X message (5)
- equity derivative (2)
- Sybase (3)
- XML (1)
- JUnit (2)
- J A X B 2.0 (1)
- N I O (1)
- windows batch file (1)
- Cruise Control (1)
- util Class (5)
- ant (1)
- JMS (1)
- profiling (0)
- Sql Server (6)
- GXT (2)
- eclipse (1)
- Generics (1)
- Tibco RV (3)
- Autosys (0)
- Message (1)
最新评论
-
houzhe11:
<property name="proxyTa ...
AOP usage -- BeanNameAutoProxyCreator usage
Executor is used to arrange thread execution. Basicly speaking, just manage, how many threads are permited to run together.
ExecutorService obj = Executors.newSingleThreadExecutor( ) -- only 1
ExecutorService obj = Executors.newFixedThreadPool(int poolSize) -- fix amount
ExecutorService obj = Executors.newCachedThreadPool( ) --- as many as it can
Code Sample
Executor e = Executors.newFixedThreadPool(5);
e.execute(new RunnableTask1( ));
e.execute(new RunnableTask2( ));
e.execute(new RunnableTask3( ));
While in another aritcle, you can see that, Executors.newFixedThreadPool(5) returns a ExecutorService. Actually, ExecutorService is a subclass of Executor, and it supplies more functionalities than Executor.
As far as ExecutorService is concerned, it supplies only one advanced function than Executor---how to stop the threads.
service.shutdownNow(); //Try to finish all Runnables(started and not started(in queue)), then, stop Executor.
service.shutdown(); //Directly stop the Executor, terminate running Runables, return back not started, yet in queue Runables.
There is a internal Queue maintained by ExecutorService. That's the core idea.
------------------------------------------------------------------------------------
Another point, Please pay attention to how they are used to different targets.
//FutureObject = ExecutorService.submit(Callable object);
//Executor.execut(Runnable object); //without any returns.
Future<BigInteger> prime1 = service.submit(new RandomPrimeSearch(512));
Future<BigInteger> prime2 = service.submit(new RandomPrimeSearch(512));
Future<BigInteger> prime3 = service.submit(new RandomPrimeSearch(512));
发表评论
-
javadoc for Cyclic Barrier
2009-04-24 12:48 848java.util.concurrent.CyclicBarr ... -
Delayed interface and Delay Queue
2009-04-22 17:42 1000/** * A standard implementati ... -
Count Down Latch example code
2009-04-22 10:38 1089Key point : 1) 1 task is co ... -
3 ways to break dead lock
2009-04-21 17:30 7031) supply special resources. ... -
Blocking Queue Usage
2009-04-20 11:21 7943 implementations: LinkedBlocki ... -
The usage of Lock and Condition
2009-04-18 12:31 1038//: concurrency/waxomatic2/WaxO ... -
Re entrantLock usage
2009-04-15 17:15 1289a thread can be really interru ... -
new interrupt in java5
2009-04-15 12:08 634In Java 5, Thread.interrupt() i ... -
interrupt
2009-04-15 10:57 7631) Each thread has a boolean in ... -
Executor Service Usage
2009-04-14 18:18 861ExecutorService exec = Executor ... -
Thread Local usage
2009-04-14 17:46 760ThreadLocal usage – from Javado ... -
Timer TimerTask usage
2009-04-14 12:03 688Timer typical usage new Tim ... -
wait, notify及线程通讯机制
2009-02-26 22:42 8031) wait(), notify() 方法被调用的时候,只要 ... -
Java Thread programming basical knowledge
2009-02-26 22:40 925yield() : Give a hint to the th ... -
Count Down Latch explanation
2008-10-02 10:29 896Very important paragraph on how ... -
Scheduled Executor Service
2008-07-22 11:27 1060Executor can return Executor, E ... -
Callable Usage
2008-07-22 10:24 884The important thing need to loo ...
相关推荐
用户应用new SparkContext后,集群就会为在Worker上分配executor,但是增加executor的时候需要考虑好内存消耗,因为一台机器的内存分配给越多的executor,每个executor的内存就越小,以致出现过多的数据spill over...
hadoop自带的Container-executor在配置yarn-kerberos时存在问题,以及在配置cgroup时需要把container-executor.cfg的上级目录拥有者均改为root,带来不便。 所以需要重新编译Container-executor,这边提供重新编译好...
FANUC C Language Executor
hadoop自带的Container-executor在配置yarn-kerberos时存在问题,这边给出编译后的Container-executor,默认加载配置文件路径/etc/container-executor.cfg,大家不用再重新编译了
高效率 快捷操作
mybatis中的sqlsession--executor实现 mybatis中的sqlsession--executor实现
基于Android开发的Executor线程池示例
该文档详细记录了Executor框架结构、使用示意图、ThreadPoolExecutor使用示例、线程池原理分析、几种常见线程池(FixedThreadPool、SingleThreadExecutor、CachedThreadPool)的详解以及线程池大小确定等内容
非常好的Java并发框架Executor图例,结构清晰,继承关系清楚。
executor 查找工具,方便查找应用软件,可以自定义文件快捷键。
executor快速启动工具,超炫,实用
NULL 博文链接:https://jsx112.iteye.com/blog/865884
xxl-job-executor-go-master
Macintosh OS 模拟程序
4.newSingleThreadExecutor 创建一个使用单个 worker 线程的 Executor,以无界队列方式来运行该线程。它只会用唯一的工作线程来执行任务,保证所有任务按照指定顺序(FIFO, LIFO, 优先级)执行。``
增强型运行,让Windows 用起来更爽快
这篇文章主要介绍下并发包下的Executor接口,Executor接口虽然作为一个非常旧的接口(JDK1.5 2004年发布),但是很多程序员对于其中的一些原理还是不熟悉,因此写这篇文章来介绍下Executor接口,同时巩固下自己的...
普罗米修斯执行者 ...Usage: ./prometheus-am-executor [options] script [args..] -f string YAML config file to use -l string HTTP Port to listen on (default ":8080") -v Enable verbose/debug log
azkaban3.4 安装包,赠送 安装文档, 可搭建分布式多 executor 节点的资源调度。
Executor: 一个接口,其定义了一个接收Runnable对象的方法executor,其方法签名为executor(Runnable command),该方法接收一个Runable实例,它用来执行一个任务,任务即一个实现了Runnable接口的类,一般来说,...