mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: Why Mina IOSession can not send message sometimes?
Date Sat, 28 Sep 2013 06:51:53 GMT
Le 9/27/13 9:42 PM, hl.0074 a écrit :
> hi
> i found a problem with mina these days,sometimes,IOSession.write(Object) can't write
the message as i expected,the writeFuture.isWritten is false when write operationComplete
,here is some code in my project i wrote:
>
> public void sendMessage(SocketMessage sm){
> System.out.println("client send.....");
> WriteFuture wf = this.ioSession.write(sm);
> wf.addListener(new IoFutureListener<IoFuture>() {
>
> @Override
> public void operationComplete(IoFuture future) {
>
> if (!((WriteFuture) future).isWritten()) {
> System.out.println("writen false...");
> sendMessage(sm);
> } else {
>         System.out.println("writen success....");
> }
> }
> }
>
> sometimes i got the logs like this,
>
>
>
> it has been resend 300+ times,but this situation is not offten appears,is it a bug or
i miss something ?


It's a bit difficult to know if it's a bug if we don't have more
information about the version you use and the kind of transport you are
using.

In any case, you should rather handle the messageSent event in your
IoHandler, this tells you when the message has been writen without
having to check the Future.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Mime
View raw message