C0urante commented on a change in pull request #8069:
URL: https://github.com/apache/kafka/pull/8069#discussion_r414016126



##########
File path: 
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Worker.java
##########
@@ -263,17 +267,20 @@ public boolean startConnector(
                 Plugins.compareAndSwapLoaders(savedLoader);
                 workerMetricsGroup.recordConnectorStartupFailure();
                 statusListener.onFailure(connName, t);
-                return false;
+                onConnectorStateChange.onCompletion(t, null);
+                return;
             }
+            workerConnector.transitionTo(initialState, onConnectorStateChange);

Review comment:
       No race is possible; `connectors` is a `ConcurrentHashMap` and its 
`putIfAbsent` method is atomic.
   
   We can just move this line (`workerConnector.transitionTo(initialState, 
onConnectorStateChange);`) back into the `try` block; it may throw an 
exception, but the callback we pass in will never be invoked until the 
`workerConnector` instance is submitted to the executor, so there should be no 
risk of it being invoked twice.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to