Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Netty Channel.write thread safe?

I have a Netty app, where I want to have more than one threads to be writing to a channel. I was just wondering whether Channel.write is thread safe?

like image 659
Tarandeep Gill Avatar asked Jun 19 '12 05:06

Tarandeep Gill


2 Answers

As you can see from the code, the ChannelOutboundBuffer.addMessage() method itself is not thread safe. However, Writing channel is "thread safe" because netty executes the write task/method in the single I/O thread.

like image 67
Adrian Liu Avatar answered Nov 04 '22 02:11

Adrian Liu


It's thread safe so you don't need to worry.

like image 29
Norman Maurer Avatar answered Nov 04 '22 04:11

Norman Maurer