Ack. That wasn't clear. Suppose we plan to expose a web service through MINA, and the typical dynamically generated response is about 100K. The response is to be served in non-blocking mode. I'm asking whether there's a way for me to chunk the output incrementally, say 10 times, 10K each time, rather than all the 100K in one go. (The objective being to reduce the runtime memory footprint in order to scale to more clients.)
Is this possible? -Babak On Wed, Mar 25, 2009 at 2:02 AM, Alexander Christian <[email protected]> wrote: > > I don't get your point. > > What would be the benefit of not using bytebuffer/iobuffer? > How else would you like to write digits to the network? > > Maybe something like this? > > session.write("3.1415926535897932384626433832795"); > > ??? > Maybe you can explain a bit more what you would like to do. > > br, > Alex > > > > On Tue, 24 Mar 2009 18:37:33 -0600, Babak Farhang <[email protected]> > wrote: >> Err.. new to Mina, and not communicating very clearly. :-x >> >> After playing with org.apache.mina.example.httpserver.codec.Server a >> bit more in the debugger, I see how to write a non-blocking response >> by first writing it to a ByteBuffer and then passing that ByteBuffer >> into the IoSession's write method. The IoSession (a SocketSessionImpl >> instance, in this case) takes care of registering the interest-op on >> the nio Selector, and calling non-blocking writes on the socket using >> the contained nio.ByteBuffer. >> >> Still, I don't understand how to write to the socket in non blocking >> manner w/o first writing it all to a ByteBuffer. For example, how to >> write the first 10**7 digits of Pi without first righting those digits >> into a ByteBuffer? OK, that's a contrived example of dynamically >> generated content, but you see my issue, I hope :) >> >> Thanks in advance >> -Babak >> >> >> On Tue, Mar 24, 2009 at 11:07 AM, Babak Farhang <[email protected]> > wrote: >>> Hi, >>> >>> I was hoping to find an example of a non-blocking I/O app using Mina >>> and TCP transport. Looked at >>> org.apache.mina.example.httpserver.codec.Server but that doesn't seem >>> to be non-blocking either. Any pointers please? >>> >>> Regards, >>> -Babak >>> >
