What are the possible reason for a java.util.concurrent.RejectedExecutionException in a SingleThreadExecutor

前端 未结 4 536
执笔经年
执笔经年 2020-12-08 13:13

I create the following executor in a singleton:

   final private ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactory() {
                 


        
4条回答
  •  不思量自难忘°
    2020-12-08 13:22

    You might have submitted tasks after calling executor.shutdown(). Normally to stop executor they do

        executor.shutdown();
        executor.awaitTermination(10, TimeUnit.MINUTES);
    

提交回复
热议问题