Are you saying Mina API Interface WriteFuture example is NOT a proper one?
Thanks.

On Dec 18, 2007 3:14 PM, Trustin Lee <[EMAIL PROTECTED]> wrote:

> Hi Qi,
>
> It's not a bug but a kind of dead lock caused by misuse of the API.
>
> You are usually not supposed to call IoFuture.join() within an
> IoHandler because the IoHandler methods might be being executed in the
> same thread with the I/O processor thread.  You wrote something and
> you call join() to wait for the I/O processor thread to finish the
> write operation in the I/O processor thread, then join() won't return
> at all.  MINA 2 detects this kind of situation automatically and emits
> advisory exception, but it's not in MINA 1.x unfortunately.
>
> The alternative to join() is adding an IoFutureListener.
>
> HTH,
> Trustin
>
> On Dec 17, 2007 4:48 PM, Qi <[EMAIL PROTECTED]> wrote:
> >
> > Hi there,
> >
> > I've just found a possible bug in MINA Datagram transport.
> >
> > In my handler class, I was trying to write some messages once the
> > sessionOpened event is fired, while the program will hang if I get the
> > writeFuture and call join() on it.
> > If I call join with a timeout parameter, after the operation gets
> timeout,
> > WriteFuture.isWritten returns false.
> > (Same senario would go through if it's via SocketConnector transport, as
> > showing in the sumup example.)
> >
> >
> > However, if I don't place the write operation inside sessionOpened();
> > instead, I placed they after DatagramConnector.connect(), then writes
> will
> > successfully go though.
> >
> > I'm using MINA 1.1.5 and JRE 1.6.
> >
> > Source code that demostrate the problem is attached.
> > http://www.nabble.com/file/p14370126/BroadcastSender.java
> > BroadcastSender.java
> > --
> > View this message in context:
> http://www.nabble.com/WriteFuture.join%28%29-hangs-when-called-in-IoHandler.sessionOpened%28%29-in-Datagram-transport.-tp14370126s16868p14370126.html
> > Sent from the Apache MINA Support Forum mailing list archive at
> Nabble.com <http://nabble.com/>.
> >
> >
>
>
>
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>

Reply via email to