[ https://issues.apache.org/jira/browse/DIRMINA-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16175946#comment-16175946 ]
西城 commented on DIRMINA-1071: ----------------------------- I know my error~~ > ReadFuture.awaitUninterruptibly(20, TimeUnit.SECONDS) is no use > --------------------------------------------------------------- > > Key: DIRMINA-1071 > URL: https://issues.apache.org/jira/browse/DIRMINA-1071 > Project: MINA > Issue Type: Bug > Affects Versions: 2.0.16 > Reporter: 西城 > Attachments: {M{}J$JUT1C401($n...@tm.png, > N8@`F_%~AEU2MYVTE]IG~IY.png, T}FF(HQ$G8WJ][7ZY7F0]2W.png > > > Describe my problem:i want to send message to client for three times, when > the first time I send to client,but client doesn't answer ,So I try to send > again,When the second time I send,I can receive the answer ,But my core is > struck in ReadFuture.awaitUninterruptibly(20, TimeUnit.SECONDS) until > cancel.That is my code,Thanks to answer. > {code:java} > if (future.isWritten()) { > log.debug("成功发送数据" + protocolMsgVO.toByteString()); > ReadFuture readFuture = session.read(); > BaseProtocolMsgVO msgReceive = null; > // 等待数据读取完成 等待10s 如果没有返回 关掉连接 > if (readFuture.awaitUninterruptibly(20, > TimeUnit.SECONDS)) { > msgReceive = (BaseProtocolMsgVO) > readFuture.getMessage(); > } else { > session.getConfig().setUseReadOperation(false); > // 设置为不需要读取数据 > if(count >= 3){ > log.info("重发超过三次,断开连接"); > // 关掉连接 > session.closeNow(); > throw new BusiException("读取设备响应数据超时"); > }else{ > log.info("重发次数:"+count); > > session.getConfig().setUseReadOperation(false); // 设置为不需要读取数据 > sendCmd(deviceIp, protocolMsgVO, > pk_user, openid); > } > > } > //重置重发次数 > session.setAttribute("count", 0); > if (readFuture.getException() != null) { > session.getConfig().setUseReadOperation(false); > // 设置为不需要读取数据 > // 关掉连接 > session.closeNow(); > throw new > BusiException(readFuture.getException().getMessage()); > } > {code} > That's my server log and tcp log -- This message was sent by Atlassian JIRA (v6.4.14#64029)