On Dec 18, 2007 4:24 PM, Steve Johns <[EMAIL PROTECTED]> wrote:
> On Dec 18, 2007 3:15 PM, Trustin Lee <[EMAIL PROTECTED]> wrote:
>
> > On Dec 17, 2007 5:20 PM, Steve Johns <[EMAIL PROTECTED]> wrote:
> > <snip/>
> >
> > > > > Can you give more hints about what the CACHE is?
> > > >
> > > > In you encoder, you could maintain a Map whose key is some message key
> > > > and whose value is encoded ByteBuffer (or byte[]).  It could probably
> > > > be a LRUMap implementation that is provided by 3rd party collections
> > > > API such as Apache Commons Collections.  You could query the map if
> > > > there's already an encoded form of the message, and reuse the encoded
> > > > data if there's one in your encoder implementation.
> > >
> > > Thanks. Trustin. I totally understood. However, where I do the message -
> > >
> > > byte[]  part? Is that supposed to be in the Encoder? But what suggested
> > > seems doing the encoding message -> byte[] part in IoHandlerAdapter or
> > > Busniess logic.
> >
> Actually this issue bothered me for quite a while, I am working on a
> financial quotation server which broadcasts the quot data to all the end
> users connected. It seemed there is no choice than encoding message->byte[]
> in my IoHandlerAdapter in my case. If I do encoding in this way, I don't
> even need a cache and just send the byte[] to all the sessions with a LOOP(
> bytebuffer.duplicat() of course). Thanks. Anyways.

What about adding EncodedMessageCachingFilter into MINA?  Then you
don't need to worry about encoding the same message many times.  Would
it work for you?

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to