> On 12 Dec 2016, at 08:23, Pei Sun <[email protected]> wrote:
> 
> Hi Netty-users and experts,
>     I have a question about the write ordering in netty.
> 
> // The following all happens in one thread.
> channel.writeAndFlush(msg1);
> channel.writeAndFlush(msg2);
> 
> Is it guaranteed that msg2 will be written after msg1? 

Yes it is.

> 
> 4.0 release notes 
> <http://netty.io/wiki/new-and-noteworthy-in-4.0.html#write-ordering---mix-eventloop-thread-and-other-threads>
>  mentioned about this and stated that the ordering are not well-defined if we 
> mix event-loop thread and other threads. But what if I all invoke the 
> writeAndFlush in one thread (not the event-loop thread)?
> 
> What if I do the following in one thread?
> 
> channel.eventloop().submit(new runnable() {
>    public void run() {channel.writeAndFlush(msg1);}
> }
> channel.eventloop().submit(new runnable() {
>    public void run() {channel.writeAndFlush(msg2);}
> }
> 

This will still run in the Eventloop thread.


> Thanks a lot.
> 
> Pei Sun
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Netty discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/netty/CAKrkhguV%2B7T97rd_0CiPZX1fwP2kMJuX2kbbzK6pohw3pJT74g%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/netty/CAKrkhguV%2B7T97rd_0CiPZX1fwP2kMJuX2kbbzK6pohw3pJT74g%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/6892A034-B2D7-4709-911D-C92BD53D4533%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to