Can I send the same ChannelBuffer to different clients concurrently?

Johnny Luong johnny.luong at trustcommerce.com
Thu Jan 6 13:49:23 EST 2011


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
>>
>>
> 



More information about the netty-users mailing list