anmolnar commented on a change in pull request #4125:
URL: https://github.com/apache/hbase/pull/4125#discussion_r832201689



##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java
##########
@@ -321,14 +319,25 @@ public void run(boolean cancelled) throws IOException {
         if (cancelled) {
           setCancelled(call);
         } else {
+          Channel channel = channelRef.get();
           if (channel == null) {
-            connect();
+            try {
+              Channel newChannel = connect();
+              if (!channelRef.compareAndSet(null, newChannel)) {
+                newChannel.close();
+              }
+              channel = channelRef.get();

Review comment:
       Shall we just add an extra null check and skip sending the call if 
channel has already been closed?
   Would you please give me more guidance on the AtomicBoolean idea?




-- 
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