"이희승 (Trustin Lee) <[EMAIL PROTECTED]>" wrote:
David M. Lloyd wrote:
On 04/28/2008 11:39 AM, "이희승 (Trustin Lee) <[EMAIL PROTECTED]>" wrote:
I'd prefer to introduce an interface type because ByteBuffer is
impossible to extend.
That's fair, but I don't see why you'd need to extend ByteBuffer anyway?

Because we can't create a Composite ByteBuffer by extending ByteBuffer.
 ByteBuffer also has unnecessary stuff like position, mark, limit,
flip(), compact() and order() which changes the state and behavior of
the buffer.  There's no way to make the position and limit read-only
while making the buffer content writable.
May be but this is just a Buffer, not a data structure ! BB are really meant to be used as a fixed and temporary storage, not as something a user application can use at will.
I don't mean to allocate a buffer per connection, I mean to allocate
buffers as needed.  An idle connection should need no buffers, if the
codec is efficiently implemented.

An efficient buffer class is needed to implement an efficient codec IMO.
We are using ByteBuffers (now renamed to IoBuffer in MINA 2) as if they were plain Sun ByteBuffer in ADS decoder, and it's pretty efficient. I'm not sure I need something different, and I'm not sure at all it can bring some improvement.


Keep in mind that people who will write decoder will know about Sun BB, but not about any other data structure. Don't force them to learn a new API, even if it's very close to the existing one ! A helper class with facility methods is generally enough.

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to