首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
【
JDK5.0特性-线程 Callable和Future
】的更多相关文章
JDK5.0特性-线程 Callable和Future
来自:http://www.cnblogs.com/taven/archive/2011/12/17/2291466.html import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; /** 从本节开始,主要介绍J2SE5.0与线程相关的新…
JDK5.0 特性-线程任务执行架构 ScheduledExecutorService
来自:http://www.cnblogs.com/taven/archive/2011/12/17/2291469.html import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util…
JDK5.0 特性-线程锁Lock
来自:http://www.cnblogs.com/taven/archive/2011/12/17/2291470.html import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.locks.Lock; import java.util.concurren…
JDK5.0 特性线程 同步装置之CountDownLatch 同步装置之CyclicBarrier 线程 BlockingQueue
来自:http://www.cnblogs.com/taven/category/475298.html import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * CountDownLatch维护一个计数器,等待这个CountDownLatch的线程必须等到计数器为0时才可以继续. * 以…
JDK5.0 特性-线程同步装置之Semaphore
来自:http://www.cnblogs.com/taven/archive/2011/12/17/2291474.html import java.util.ArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Semaphore; import java.util.concurrent.locks.L…
JDK5.0 特性-线程 Condition
来自:http://www.cnblogs.com/taven/archive/2011/12/17/2291471.html import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.…
JavaSE---多线程---Callable、Future
1.概述 1.1 JDK1.5后,Java提供了Callable接口,该接口提供一个call方法作为线程执行体,该call方法可以 有返回值.声明抛出异常: 因此,我们可以直接将Callable接口作为target来创建线程,但是:Callable接口是新增的接口,不是Runnable的实现类: JDK1.5后又提供了Future接口,并提供Future接口的实现类FutureTask(该类实现了Runnable接口,可以作为Thread的target): 1.2 创建.启动有返回值的线程:…
JDK5.0 特性 监控与管理虚拟机
来自:http://www.cnblogs.com/taven/archive/2011/12/17/2291465.html import java.lang.management.ClassLoadingMXBean; import java.lang.management.CompilationMXBean; import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementF…
JDK5.0特性,使用ProcessBuilder执行本地命令
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.ut…
集合框架-工具类-JDK5.0特性-函数可变参数
1 package cn.itcast.p4.news.demo; 2 3 public class ParamterDemo { 4 5 public static void main(String[] args) { 6 // TODO Auto-generated method stub 7 // int sum = add(4, 5); 8 // System.out.println("sum="+sum); 9 // int sum1 = add(4, 5, 6); 10 /…