directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Irving, Dave" <>
Subject [mina] Writing to an IoSession
Date Tue, 25 Oct 2005 10:48:36 GMT

Im writing an Http server based on Mina. The tutorial was great and got
me started in the right direction. I'm using a "stateful" parser
approach like that used in ASN1 - and it fitted in very nicely.
Currently, I can ** parse ** around 24,000 HTTP requests per second -
and with multiple (non-HTTP-pipelining) connections, I can service
around 700 requests a second. This will improve massively in a few days
when I implement keep-alive.
So - after that background, I first want to say a big thank-you for
MINA. So far, it has proved very stable, and very fast - and hey, I was
getting bored of writing selector loops anyway :o)

One question I do have: Currently Im holding on to the IoSession
associated with a request so that when a response becomes available
(asyncronously), it knows where to write it to. I cant see any other way
of knowing where a response is destined for.
E.g, (cut down, sort of psudo-code)

 * Invoked asyncronously when a response is comitted - and ready to be 
 * written
void handleResponse(Request req, Response resp, Object marker) {
  IoSession session = req.getContext().getSession();
  ByteBuffer buff = getBufferFor(resp);
  session.write(buff, marker);

Should I be holding on to sessions like this - or looking them up by
some other means?
It doesn't seem clear from the tutorial.

Many thanks,


This e-mail and any attachment is for authorised use by the intended recipient(s) only. It
may contain proprietary material, confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any other party. If you are not
an intended recipient then please promptly delete this e-mail and any attachment and all copies
and inform the sender. Thank you.

View raw message