线程对象
2020-11-23 10:40:12 0 举报
多线程对象的创建不同方式
作者其他创作
大纲/内容
Executorexecute
ExecutorCompletionService
返回一个Future
executor要execute一个Runnable
RunnableFuture
executor要submit一个Callable
CompletionServicenewTaskForsubmittakepoll结合了Executor和BlockingQueue,用队列操纵线程返回的结果
Executors 添加线程池功能newFixedThreadPoolnewFixedCachedThreadPoolcallable?
ThreadjoinwaitsleeprunstartresumedestroyexitinterruptisAliveisDaemonyield
RunnableRun不能带回返回值
FuturegetcancelisCancelledisDone
Callable能带回返回值
FutureTaskgetrunsetisCancelledisDonedonecancel
0 条评论
下一页