On 4/12/07, Maarten Bosteels <[EMAIL PROTECTED]> wrote:
<snip/>
> It sounds very interesting. Assuming we have ReadFuture, should > IoHandler.messageReceived() be notified? Not sure about that. How are people currently implementing a client that wants to wait for a response ? I did a very quick-and-dirty implementation: * store a ReadFuture in the session * IoHandler.messageReceived(Object message) calls readFuture.setResult (message) But it's of course way too simplistic. For instance, it should be possible to do session.write(); ReadFuture f1 = session.read(); ReadFuture f2 = session.read(); f1.join(); f2.join(); Storing a list of ReadFuture's in the IoSession is probably not a good idea ?
Hmm... I feel the internal implementation might become very complex. It's just a feeling, so we need to try to implement it. BTW what would be the advantage of returning future over just providing awaitMessage() like the following? Object m1 = session.awaitMessage(); Object m2 = session.awaitMessage(); Actually I implemented similar stuff in RequestResponseFilter: Request req = ...; session.write(req); Response res = req.awaitResponse(); It might also be better to provide an IoHandler implementation that provides a blocking message queue, like we did with StreamIoHandler. WDYT? Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6
