Thanks all. However I use one session one encoder object now. Do you guys
means that I have to move the encoder filter? and put it in the business
logic? I believe boardcast is very popular in server. What should I do?

2007/4/25, Trustin Lee <[EMAIL PROTECTED]>:

On 4/25/07, Eero Nevalainen <[EMAIL PROTECTED]> wrote:
> Trustin Lee wrote:
> >> > If so,
> >> > should I move my encoding part in the IoHandler which means
> >> > encoding once
> >> > and send bytes to sessions(without encoding N times but once).
> >
> > You can do that, but it's not encouraged.  I'd use a LRU cache so the
> > encoded buffer is cached, and reused on and on.  Of course, you will
> > have to use the duplicate of the encoded buffer:
> >
> > ByteBuffer data = cache.get(message);
> > out.write(data.duplicate());
>
> I have to do something like this as well. Do you mean that this is
> called from the encoder? So that the encoder has the cache as an
> instance variable and for each session to broadcast it will retrieve the
> message from the cache?

Yes, exactly. :)

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

Reply via email to