smiklosovic commented on code in PR #4394:
URL: https://github.com/apache/cassandra/pull/4394#discussion_r2377845015


##########
src/java/org/apache/cassandra/gms/Gossiper.java:
##########
@@ -2070,6 +2071,74 @@ public void setLooseEmptyEnabled(boolean enabled)
         EndpointState.LOOSE_DEF_OF_EMPTY_ENABLED = enabled;
     }
 
+    @Override
+    public Map<String, Map<String, Object>> echoAllNodesWithTiming()
+    {
+        Map<String, Map<String, Object>> results = new HashMap<>();
+        Set<InetAddressAndPort> liveMembers = getLiveMembers();
+        
+        for (InetAddressAndPort endpoint : liveMembers)
+        {
+            Map<String, Object> nodeResult = new HashMap<>();
+            
+            // Skip self - no need to echo to ourselves
+            if (endpoint.equals(getBroadcastAddressAndPort()))
+            {
+                nodeResult.put("status", "SELF");
+                nodeResult.put("responseTimeMs", 0);
+                nodeResult.put("timestamp", System.currentTimeMillis());
+                results.put(endpoint.toString(), nodeResult);
+                continue;
+            }
+            
+            long startTime = System.nanoTime();
+            long timestamp = System.currentTimeMillis();
+            
+            try
+            {
+                // Create ECHO_REQ message with no payload
+                Message<NoPayload> echoMessage = Message.out(ECHO_REQ, 
noPayload);
+                
+                // Async response handling
+                CompletableFuture<String> future = new CompletableFuture<>();
+                
+                RequestCallback echoHandler = msg -> {
+                    future.complete("ALIVE");
+                };
+                
+                // Send message with callback
+                MessagingService.instance().sendWithCallback(echoMessage, 
endpoint, echoHandler);
+                
+                // Wait for response with 5-second timeout
+                String status = future.get(5, TimeUnit.SECONDS);

Review Comment:
   I am not completely sure about this. I think we might timeout when 
MessageService.instace() timeouts on its own and fails so calls `onFailure` 
with the reason. 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to