pivotal-jbarrett commented on code in PR #7740:
URL: https://github.com/apache/geode/pull/7740#discussion_r887255651


##########
geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java:
##########
@@ -862,8 +862,9 @@ public void recoverPrimary(Set<ServerLocation> 
excludedServers) {
       return;
     }
     final boolean isDebugEnabled = logger.isDebugEnabled();
-    if (queueConnections != null && queueConnections.getPrimary() != null
-        && !queueConnections.getPrimary().isDestroyed()) {
+    ConnectionList snapshot = queueConnections;

Review Comment:
   Alternatively:
   ```java
   if (primaryNotDestroyed(queueConnections)) {
      ...
   }
   
   
   ...
   
   static boolean primaryNotDestroyed(final ConnectionList connectionList) {
     if (null != connectionList) {
       final Connection primaryConnection = connectionList.getPrimary();
       if (null != primaryConnection) {
         return !primaryConnection.isDestroyed();
       }
     } 
     return false;
   }
   ```
   Now this new method is unit testable and guaranteed to be a non-volatile 
reference.



-- 
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: notifications-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to