executor = new ThreadPoolExecutor(2, 2, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10000 * 10), new RejectedExecutionHandler() { //向线程池提交任务出现异常时 @Override public void rejectedExecution(Runnable runnable, ThreadPoolExecutor threadpoolexecutor) { try { // 取得线程池队列并使用阻塞入队方法 threadpoolexecutor.getQueue().put(runnable); } catch (InterruptedException e) { throw new RuntimeException(e); } } });
JAVA 阻塞队列 线程池
猜你喜欢
转载自hewei5894.iteye.com/blog/2339505
今日推荐
周排行