From 6b91751bea19bbf3e87610f7fda97aa8bacf9daf Mon Sep 17 00:00:00 2001 From: Chris Vest Date: Wed, 16 Dec 2020 12:31:49 +0100 Subject: [PATCH] Small polishing that addresses PR comments --- src/main/java/io/netty/buffer/api/BufRef.java | 2 ++ src/main/java/io/netty/buffer/api/memseg/BifurcatedDrop.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/netty/buffer/api/BufRef.java b/src/main/java/io/netty/buffer/api/BufRef.java index 6e6d56a..7380d8f 100644 --- a/src/main/java/io/netty/buffer/api/BufRef.java +++ b/src/main/java/io/netty/buffer/api/BufRef.java @@ -29,6 +29,7 @@ public final class BufRef extends BufHolder { */ public BufRef(Buf buf) { super(buf); + // BufRef is meant to be atomic, so we need to add a fence to get the semantics of a volatile store. VarHandle.fullFence(); } @@ -39,6 +40,7 @@ public final class BufRef extends BufHolder { */ public BufRef(Send send) { super(send); + // BufRef is meant to be atomic, so we need to add a fence to get the semantics of a volatile store. VarHandle.fullFence(); } diff --git a/src/main/java/io/netty/buffer/api/memseg/BifurcatedDrop.java b/src/main/java/io/netty/buffer/api/memseg/BifurcatedDrop.java index 0322ad5..91629d2 100644 --- a/src/main/java/io/netty/buffer/api/memseg/BifurcatedDrop.java +++ b/src/main/java/io/netty/buffer/api/memseg/BifurcatedDrop.java @@ -50,7 +50,7 @@ class BifurcatedDrop implements Drop { } @Override - public synchronized void drop(MemSegBuf buf) { + public void drop(MemSegBuf buf) { int c; int n; do {