java提供了的线程机制
1.继承Thread类
2.实现Runnable接口
如果要从任务返回值,则要实现Callable接口
任务的启动方式
调用Thread的start()方法
交给ExcuterService执行。
ExcuterService exec = Excuters.newCache……。
1.继承Thread类
2.实现Runnable接口
如果要从任务返回值,则要实现Callable接口
任务的启动方式
调用Thread的start()方法
交给ExcuterService执行。
ExcuterService exec = Excuters.newCache……。