ncliang commented on a change in pull request #9669:
URL: https://github.com/apache/kafka/pull/9669#discussion_r533788764



##########
File path: 
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerSourceTask.java
##########
@@ -206,16 +203,13 @@ public void cancel() {
     public void stop() {
         super.stop();
         stopRequestedLatch.countDown();
-        synchronized (this) {
-            if (finishedStart)
-                tryStop();
-            else
-                startedShutdownBeforeStartCompleted = true;
-        }
     }
 
-    private synchronized void tryStop() {
-        if (!stopped) {
+    // Note: This method is not thread-safe
+    private void tryStop() {
+        // If the task is scheduled for shutdown before we invoke initialize 
or start on it (which
+        // can happy reliably if it's started in the PAUSED state), we don't 
have to invoke stop on it

Review comment:
       ```suggestion
           // can happen reliably if it's started in the PAUSED state), we 
don't have to invoke stop on it
   ```




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