Can I send the same ChannelBuffer to different clients concurrently?

Timmy Chen chentm at gmail.com
Thu Jan 6 20:25:17 EST 2011


Thanks for the answers. I am going to use a ChannelBuffer pool to
avoid creating a new ChannelBuffer for each connected user which is
bad for gc.

On Fri, Jan 7, 2011 at 2:49 AM, Johnny Luong
<johnny.luong at trustcommerce.com> wrote:
> You could probably get away with a static byte array and using the
> wrapped method of the ChannelBuffers to construct a ChannelBuffer.
>
>
> On 01/05/2011 08:21 PM, redstrato wrote:
>> Hi,
>>
>> I think you can use ChannelGroup but actually this will also duplicate your
>> ChannelBuffer internally to avoid a race condition.
>>
>> http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/group/ChannelGroup.html#write(java.lang.Object)
>>
>> if you want to use only one ChannelBuffer for all Channels, you should
>> synchronize your ChannelBuffer for each Channel and this can cause
>> performance issues.
>>
>> --
>> redstrato
>>
>>
>>
>> basketboy wrote:
>>>
>>> Hi,
>>>
>>> I need to send the same message to every client that connects to the
>>> server. To avoid the overhead of creating a new ChannelBuffer every
>>> time, I tend to create a static one and send it to users. Is it going
>>> to cause any problem in performance/correctness? Thanks in advance.
>>>
>>> --
>>> Timmy
>>> _______________________________________________
>>> netty-users mailing list
>>> netty-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>
>>>
>>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>



-- 
Timmy


More information about the netty-users mailing list