You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Alex Karasulu <ao...@bellsouth.net> on 2004/02/28 08:50:16 UTC

[codec] Stateful Decoders Part Due

Ok I'm still playing around with decoders that better match the needs of NIO
based servers which need a small preferably fixed constant size decode
footprint.
Hi,

Attached are interfaces for a stateful decoder and its helper callback 
Interface.  For the discussion I have the stripped down interfaces here:

public interface StatefulDecoder
{
    void decode( ByteBuffer buffer ) throws DecoderException ;
    void register( DecoderCallback cb ) ;
}

public interface DecoderCallback
{
    void decodeOccurred( StatefulDecoder decoder, Object decoded ) ;
}

So what's the difference?  I took some of Noel's comments and combined it 
with the push based approach I was playing around with before.  So now it is

still a push model but with decoder notification rather than polling.  The
notification can be synchronous or asynchronous with the decode call 
depending on the implementation.  The only constant is the fact that such 
a decoder is stateful and hence must be dedicated to a channel.

Oh and btw instead of dealing with events which would just wrap the decoder 
(source) and the decoded object we make a call minus an event object 
instantiation using both the source and the resultant object.  If clients
want to wrap it in an event they can then pay the price and do so.

Thoughts?  

Alex