title: 线程池
copyright: true
categories: springmvc和springboot
tags: 参数
password:
- 线程池:
Public class CommonTest{
@Test
Public void test2()throws Exception{
try{
ExecutorService executorService =Executors.newFixedThreadPool(100);
FutureTask<String> futureTask= new FutureTask<String>(newCallable<String>(){
@Override
Public String call()throws Exception{
thrownewException("adasd");
}});
executorService.execute(futureTask);
while(1==1){
Boolean done= futureTask.isDone();
if(done){
System.out.println(futureTask.get());
break;
}else{
System.out.println("joijoi");
}}
}catch(Exceptione){
e.printStackTrace();
}
}
}
网友评论