Execute框架
来源:互联网 发布:sfda数据查询 编辑:程序博客网 时间:2024/06/14 01:43
Execute框架是Java并发包里面的框架
简介
把任务的提交和执行解耦.
要执行任务的人只需把Task描述清楚,然后提交即可。这个Task是怎么被执行的,被谁执行的,什么时候执行的,提交的人就不用关心了。具体点讲,提交一个Callable对象给ExecutorService(如最常用的线程池ThreadPoolExecutor),将得到一个Future对象,调用Future对象的get方法等待执行结果就好了。
类结构
public interface Executor { /** * Executes the given command at some time in the future. The command * may execute in a new thread, in a pooled thread, or in the calling * thread, at the discretion of the {@code Executor} implementation. * * @param command the runnable task * @throws RejectedExecutionException if this task cannot be * accepted for execution * @throws NullPointerException if command is null */ void execute(Runnable command);}
按照层次结构看每个类的功能:
ExecutorService
定义了一个服务,定义了完整的线程池的行为,可以接受提交任务、执行任务、关闭服务
AbstractExecutorService
实现了ExecutorService接口,也实现了接口定义的默认行为。
ThreadPoolExecutor
实现了execute方法.
管理线程池.
请关注最重要的两个数据结构:
//任务队列private final BlockingQueue<Runnable> workQueue;//作业线程集合private final HashSet<Worker> workers = new HashSet<Worker>();
其他
0 0
- Execute框架
- execute
- Java并发---- Executor并发框架--ThreadToolExecutor类详解(execute方法)
- execute sp_executesql 和 execute
- struts2框架中Action必须实现execute方法?和Struts参数传递
- Java并发---- Executor并发框架--ThreadToolExecutor类详解(execute方法,关闭方法)
- hibernate框架时遇到的错误ognl.MethodFailedException: Method "execute" f
- Java并发---- Executor并发框架--ThreadToolExecutor类详解(execute方法,关闭方法)
- Execute immediate
- execute sp_executesql
- execute immediate
- EXECUTE IMMEDIATE
- EXECUTE IMMEDIATE
- execute 使用方法
- EXECUTE IMMEDIATE
- execute path
- EXECUTE IMMEDIATE
- execute immediate
- Android的Usb设备的监听(Dev)外设端口的判定以及耳机的插拔
- zookeeper难以理解易混淆的几点
- zookeeper的两种分布式锁的源代码点评
- zookeeper的进程锁,多线程及负载原理的理解
- oracle笔记第一篇——表分区及分区索引
- Execute框架
- css hacker
- js的面向对象使用,传参的新方式,时间格式的传递
- php 基本语法
- 深入浅出nodejs学习笔记--第四章 异步编程
- 线程池满了如何处理及spring参数设置:
- volatile 和 synchronized区别
- .NET- 可以Load元素以数字开头的XML吗?
- php 变量