监听线程是否执行完毕
ThreadPoolExecutor executor= new ThreadPoolExecutor(1, 1, 1000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1),Executors.defaultThreadFactory()); executor.shutdown(); if (executor.isTerminated()) { //巴拉巴拉巴拉巴拉 }
ThreadPoolExecutor executor= new ThreadPoolExecutor(1, 1, 1000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1),Executors.defaultThreadFactory()); executor.shutdown(); if (executor.isTerminated()) { //巴拉巴拉巴拉巴拉 }