列举几种线程池实现:【1】ExecutorServicehttp://www.gznc.edu.cn/yxsz/jjglxy/book/Java_api/java/util/concurrent/ExecutorService.html【2】ScheduledExecutorServicehttp://www.gznc.edu.cn/yxsz/jjglxy/book/Java_api/java/util/concurrent/ScheduledExecutorService.html【3】ThreadPoolExecutorhttp://www.gznc.edu.cn/yxsz/jjglxy/ Read More
posted @ 2012-06-20 13:58 技术草根女 Views(1041) Comments(0) Diggs(0) Edit
【Future】http://www.gznc.edu.cn/yxsz/jjglxy/book/Java_api/java/util/concurrent/Future.html【好奇】(1)future.cancel(mayInterruptIfRunning)的内部实现会是什么样子的?可以中断一个线程池里正在执行着的“那一个”任务。可猜想,必定记录着具体线程标识,且发了一个中断信号。(2)猜测,应该只是发一个中断信号,可以中断阻塞中的操作。而如果是while(true); 这样的占用CPU的非阻塞式操作,是中断不掉的,也即线程依旧在跑,占用着线程池资源。【注意】a). 线程池资源有限,有些 Read More
posted @ 2012-06-20 13:16 技术草根女 Views(13981) Comments(0) Diggs(0) Edit