commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Karasulu" <>
Subject [codec] Stateful Decoders Part Due
Date Sat, 28 Feb 2004 07:50:16 GMT
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

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.



View raw message