NealSun96 commented on a change in pull request #1460:
URL: https://github.com/apache/helix/pull/1460#discussion_r504279775



##########
File path: 
helix-core/src/main/java/org/apache/helix/messaging/handling/AsyncCallbackService.java
##########
@@ -113,12 +104,19 @@ public HelixTaskResult handleMessage() throws 
InterruptedException {
           + _correlationId);
 
       AsyncCallback callback = _callbackMap.get(_correlationId);
-      synchronized (callback) {
-        callback.onReply(_message);
-        if (callback.isDone()) {
-          _logger.info("Removing finished callback, correlationid:" + 
_correlationId);
-          _callbackMap.remove(_correlationId);
+      if (callback != null) {
+        synchronized (callback) {
+          callback.onReply(_message);
+          if (callback.isDone()) {
+            _logger.info("Removing finished callback, correlationid:" + 
_correlationId);
+            _callbackMap.remove(_correlationId);
+          }
         }
+      } else {
+        String msg = "Message " + _message.getMsgId()
+            + " does not have correponding callback. Probably timed out 
already. Correlation id: "
+            + _correlationId;
+        _logger.warn(msg);

Review comment:
       I see what you mean now: you're saying in both cases, callback.isDone() 
== false, and it can't be distinguished whether the callback failed or there's 
no callback registered. 
   
   If the callback fails due to some exception like you said, the task result 
will reflect that (setException(e), setInterrupted(true)). It's more difficult 
to tell the "callback not registered" case, but since customers don't want 
exceptions raised, there isn't any better way here.




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

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