ivandika3 commented on code in PR #955:
URL: https://github.com/apache/ratis/pull/955#discussion_r1376234658


##########
ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientStreamRpc.java:
##########
@@ -78,7 +80,33 @@ public class NettyClientStreamRpc implements 
DataStreamClientRpc {
   public static final Logger LOG = 
LoggerFactory.getLogger(NettyClientStreamRpc.class);
 
   private static class WorkerGroupGetter implements Supplier<EventLoopGroup> {
-    private static final AtomicReference<EventLoopGroup> SHARED_WORKER_GROUP = 
new AtomicReference<>();
+
+    private static final 
AtomicReference<ReferenceCountedObject<EventLoopGroup>> SHARED_WORKER_GROUP =
+        new AtomicReference<>();

Review Comment:
   > since AtomicReference.updateAndGet(updateFunction) may call the 
updateFunction without using the result. The current code will then called 
newWorkerGroup(..) without shutting it down.
   
   Do you mean it's because `AtomicReference.updateAndGet(updateFunction)` 
might get re-applied, as mentioned in the `AtomicReference` documentation?
   
   > Since it may be re-applied when attempted updates fail due to contention 
among threads.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to