Java???????????????
???????????? ???????[ 2014/5/22 11:32:36 ] ????????Java ??????????
????????
?????????ThreadPoolExecutor???????????Executors??????????????????????????????????????С?????忴??????????
public class TestThread {
/**
* ?????????????????????????
* ??????????????????ζ?????????
* Executors.newCachedThreadPool()???÷????????????????????????????????1??????????
* ???????Executors.newFixedThreadPool(n)
*
* ?????????????????????SecheduledThreadPoolExecutor
*/
public static void main(String[] args) throws InterruptedException?? ExecutionException {
int nThreads = 5;
/**
* Executors??ThreadPoolExecutor???????????
*/
ExecutorService executor = Executors.newFixedThreadPool(nThreads);
//submit?з????????execute??з???????з????????Exception?????
Future res = executor.submit(new ConsumerThread());
//executor.execute(new ConsumerThread());
/**
* shutdown???ú?????????submit?μ?task?????submit??????????
* shutdownNow????????????е?task??????????δ??е?task??list
*/
executor.shutdown();
//???shutdown????shutdown????????е??????????????????????????????к???????
executor.awaitTermination(1?? TimeUnit.DAYS);
//?????н???????????????????????????execute????????????????????????????submit??????????res.get()????????????????????
System.out.println("future result:"+res.get());
}
static class ConsumerThread implements Runnable{
@Override
public void run() {
for(int i=0;i<5;i++) {
System.out.println(i);
}
}
}
}
|
?????????
????0
????1
????2
????3
????4
????future result:null
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????