未来开发者 2015-10-17 03:18 采纳率: 0%
浏览 1484

我的java难道是盗版吗(调用有返回值的函数无响应)

boolean flag = pcSystem.returnTenderResult(bidDocu,tenderDocu);

我在自定义pcSystem类中调用一个具有boolean返回值的函数returnTenderResult(synchronized)

这条语句的上一条语句都会执行,而returnTenderResult内方法一定概率上不执行

(方法内的第一条语句都没有执行,还不涉及方法内具体逻辑),系统涉及了多线程,

这是为什么啊

 public synchronized boolean reviewOtherCommForhelpTask(BidDocu bidDocu,TenderDocu tenderDocu) throws IOException{//评审其他社区寻求帮助任务的时间及资源
        boolean flag = false;
//      ====================================
        Date nowDate = new Date();

        String log = "reviewOtherComm,当前用时"+(nowDate.getTime()-TimerManager.getTimerStamp()[0])+
                "ms"+System.getProperty("line.separator");
        TakeNotes.recordLogs(commid, log);
//      ====================================
        if(bidDocu.getFid()<=CommMessageManager.pcFid){
            //PC
//          ====================================
                    nowDate = new Date();
                    log = "check Pc Task,当前用时"+(nowDate.getTime()-TimerManager.getTimerStamp()[0])+
                            "ms"+System.getProperty("line.separator");
                    TakeNotes.recordLogs(commid, log);
//                  ====================================
            flag = pcSystem.returnTenderResult(bidDocu,tenderDocu);
        }else {
            //Robot
//          ====================================
                    nowDate = new Date();
                    log = "check Robot Task,当前用时"+(nowDate.getTime()-TimerManager.getTimerStamp()[0])+
                            "ms"+System.getProperty("line.separator");
                    TakeNotes.recordLogs(commid, log);
//                  ====================================
            flag = robotSystem.returnTenderResult(bidDocu,tenderDocu);
        }
        return flag;
    }
 public synchronized boolean returnTenderResult(BidDocu forHelpBidDocu,TenderDocu tenderDocu) throws IOException{
        Date nowDate = new Date();
        String log;
        boolean flag = false;
//      =================================
        nowDate = new Date();
        log = "returnTenderResult,当前时间"+
                (nowDate.getTime()-TimerManager.getTimerStamp()[0])+"ms"+
                    System.getProperty("line.separator");
        TakeNotes.recordLogs(commid,log);
//      =================================
}
  • 写回答

4条回答 默认 最新

  • IT_Trojan 2015-10-17 04:10
    关注

    是不是多线程的问题,执行顺序是怎么样的

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器