I'd like to add more pepper to Peter's comment. :) On 4/25/07, peter royal <[EMAIL PROTECTED]> wrote:
On Apr 21, 2007, at 8:38 AM, mat wrote: > I implemented my protocol encoding in the procotol filter and I > used one > session one object method. I just wonder if I try to boardbast the > message > to N clients, which means the encoding part will be called N times?
Yes.
> 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()); HTH, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6
