You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by James Ling <cl...@tengshang.com> on 2007/04/26 03:48:30 UTC

答复: boardcasting

Hi everyone,
	I have a question that what's the difference between ByteBuffer's
slice() and duplicate().I have tried them both in broadcasting msgs.They
seemed to work the same
	Thanks in advance
Best Wishes
James Ling
> -----邮件原件-----
> 发件人: mat [mailto:forum.maillist@gmail.com]
> 发送时间: 2007年4月25日 23:11
> 收件人: dev@mina.apache.org
> 主题: Re: boardcasting
> 
> 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 <tr...@gmail.com>:
> >
> > On 4/25/07, Eero Nevalainen <ee...@indagon.com> 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
> >