并发编程框架Disruptor,执行shutdown就会卡死。

在使用并发编程框架Disruptor,执行shutdown就会卡死。

 public synchronized  void authNewPersonalByRotmote() {
        if (flag) return;
        flag = true;
        log.info("获取待远程验证的身份证记录");
        NewDisruptorPublisher publisher= NewDisruptorPublisher.getNewPersonalInstance();
        try {
            List<PersonalInfo> list = personalInfoDao.getPersonalByAllWaitAuth();
            if (list.size() < 1) {
                flag = false;
                return;
            }
            //按照姓名身份证号 逐条远程验证获取回执
            for (PersonalInfo info : list) {
                publisher.publish(new NewPersonalEventArgs(info));
            }
        } catch (Exception ex) {
            log.error("身份证验证发生错误", ex);
            return;
        }finally {
            publisher.shutdown();
            flag = false;
        }
    }

如果执行disruptorNewPersonal.shutdown();程序就被卡死、如果不执行Handler中的事件正常执行

 public void shutdown() {
        if (personalFlag) {
           disruptorPersonal.shutdown();
            personalFlag = false;
        }
        if (personalNewFlag) {
           disruptorNewPersonal.shutdown();
           personalNewFlag = false;
        }
        //   disruptorEntry.shutdown();
        if (entryFlag) {
            disruptorEntry.shutdown();
            entryFlag = false;
        }
        if (fileFlag) {
            disruptorFile.shutdown();
            fileFlag = false;
        }
    }
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问