Apache HttpComponents and Java NIO
<p>I read something about Java NIO, so i now know there is thing called selector, where i can register channels and let selector check for some events on those channels. One of event is OP_WRITE. If selector detect OP_WRITE key on some channel, it tell me that channel is ready for writing to it. </p>

<p>I need to do one application, which will be used through HTTP protocol, so i am studying Apache HTTP Components library now. In this library is interface called HttpAsyncExchange and it is implemented by class Exchange. Instance of Exchange class have method called submitResponse and if this method is invoked, then underlying socketChannel will be marked as OP_WRITE. So instead of sending response directly to client after resolving request, the response is sended later when selector return me that underlying socketChannel because of event OP_WRITE on it. </p>

<p>I dont understand where is benefit of "marking" socketChannel as OP_WRITE and sending response later, instead of sending response directly, can anyone explain me? Sorry for my bad english.</p>
