20,808
社区成员
发帖
与我相关
我的任务
分享
public void stop() {
this.executorService.shutdown();
this.woker.stop();
try {
//关闭线程池后 休眠三秒 用于让所有在线程池中没有执行完的任务继续执行完
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
LogUtils.logWarn("MQ client Stoped!");
}
for (String queueName : this.queues) {
workCount ++;
AbstractQueue abstractQueue = QueueFactory.createQueue(queueName, this.channels.get(queueName),
this.queueConsumers.get(queueName));
if (abstractQueue != null){
if (executorService.isShutdown()) {
//executorService 我这里怎么处理,要不下面会报错
}
executorService.submit(abstractQueue);
LogUtils.logInfo("Create worker [ " + queueName + " ]");
}