On Tue, 9 Apr 2002, Remy Maucherat wrote: > > BTW, this is a very cool idea - it avoids one copy and allocations, > > and simplifies the code. But it deserves a comment :-). > > Yes, indeed. I worked hard so that there wouldn't be any useless copy.
Yes, excelent !. > > One question for future - who should 'own' the OutputBuffer's buffer ? > > If we consistently say that the buffers are owned by the protocol we > > could make another improvement in speed - since in Ajp case we could > > avoid another copy. > > I don't see why, but it's another story. > The adapter has to have its own buffer, so it is perfectly admissible for it > to use it. After that, the protocol can do whatever it wants. > Also, since there's no way to pass the pointer to the buffer to the adapter, > I don't see how the adapter could use an internal buffer. Well, it's the same thing as with the input buffer. The protocol can setBuffer() on the response and 'own' the byte[] where the response writes. For HTTP - it doesn't matter, you just write the content directly. For AJP ( and probably other protocols ) we need to 'wrap' the buffer with a header, etc. writev() would be nice, but we're not in C. I think nio supports this concept, but we don't use nio yet. If the protocl owns the buffer, we can allocate the space for header and give the body region to the connector, then send directly, with 0 copy on write. With the current model - I don't think we can avoid the copy. ( but it's good we do avoid it on read !). Anyway - not a big priority. Costin -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
