提交 4e8e049a authored 作者: WEIZIBIN's avatar WEIZIBIN

waitting for running thread shutdown before callback thread toStop

上级 59f68132
......@@ -86,6 +86,11 @@ public class XxlJobExecutor {
initRpcProvider(ip, port, appName, accessToken);
}
public void destroy(){
List<JobThread> runningThreads = new ArrayList<>(jobThreadRepository.values());
if (logger.isInfoEnabled()) {
logger.info("running threads {}", runningThreads);
}
// destory jobThreadRepository
if (jobThreadRepository.size() > 0) {
for (Map.Entry<Integer, JobThread> item: jobThreadRepository.entrySet()) {
......@@ -95,6 +100,15 @@ public class XxlJobExecutor {
}
jobHandlerRepository.clear();
for (JobThread runningThread : runningThreads) {
try {
// wait for all job thread push result to callback queue
runningThread.join();
} catch (InterruptedException e) {
logger.warn("interrupted while stopping {}", runningThread);
break;
}
}
// destory JobLogFileCleanThread
JobLogFileCleanThread.getInstance().toStop();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论