diff --git a/common/src/main/java/io/netty/util/internal/MpscLinkedQueue.java b/common/src/main/java/io/netty/util/internal/MpscLinkedQueue.java index c1b931a562..a1a8c2c9d1 100644 --- a/common/src/main/java/io/netty/util/internal/MpscLinkedQueue.java +++ b/common/src/main/java/io/netty/util/internal/MpscLinkedQueue.java @@ -32,22 +32,19 @@ import java.util.Queue; * A lock-free concurrent single-consumer multi-producer {@link Queue}. * It allows multiple producer threads to perform the following operations simultaneously: * * .. while only one consumer thread is allowed to perform the following operations exclusively: * * * The behavior of this implementation is undefined if you perform the operations for a consumer thread only @@ -184,7 +181,7 @@ final class MpscLinkedQueue extends MpscLinkedQueueTailRef implements Queu @Override public boolean isEmpty() { - return peekNode() == null; + return headRef() == tailRef(); } @Override diff --git a/common/src/main/java/io/netty/util/internal/MpscLinkedQueueHeadRef.java b/common/src/main/java/io/netty/util/internal/MpscLinkedQueueHeadRef.java index cf8d4a91b2..fabcf42ed4 100644 --- a/common/src/main/java/io/netty/util/internal/MpscLinkedQueueHeadRef.java +++ b/common/src/main/java/io/netty/util/internal/MpscLinkedQueueHeadRef.java @@ -38,7 +38,7 @@ abstract class MpscLinkedQueueHeadRef extends MpscLinkedQueuePad0 implemen UPDATER = updater; } - private transient volatile MpscLinkedQueueNode headRef; + private transient volatile MpscLinkedQueueNode headRef; protected final MpscLinkedQueueNode headRef() { return headRef;