线程池中所有线程结束捕捉
??下面的代码只是一个引子或者一种方案。????
? ThreadPoolExecutor threadPool=new ThreadPoolExecutor(20, 50, 50000,TimeUnit.MILLISECONDS
??????????? , new ArrayBlockingQueue<Runnable>(5, true));
??????? for(int i=0;i<30;i++)
??????? {
??????????? threadPool.execute(new Runnable()
??????????? {
??????????????? public void run()
??????????????? {
??????????????????? try
??????????????????? {
??????????????????????? int random=getRandom(500, 4000);
??????????????????????? Thread.sleep(random);
??????????????????????? ++count;
??????????????????????? if(count>=30)
??????????????????????? {
????????????????????????? System.out.println("All Thread is Finished!!!!!!!!!!!!!!");?
??????????????????????? }
??????????????????? }catch (InterruptedException e){}
??????????????? }
??????????? });
??????? }