How is an executor termination recursion in java?

后端 未结 2 2051
无人及你
无人及你 2020-12-20 07:34

This is a program that reads information site for previous format it uses recursion and executor.It works fine,my problem is to test whether the program is completed and suc

2条回答
  •  天命终不由人
    2020-12-20 08:16

    You can't submit any new tasks after you shutdown the ExecutorService, the recursion seems to stop after you've processed all the levels (you don't submit any new tasks after that), you can do something like this:

    if (level > levels.length - 1) {    
        executor.shutdown();
        return; 
    }   
    

提交回复
热议问题