C0urante commented on a change in pull request #9669: URL: https://github.com/apache/kafka/pull/9669#discussion_r534453206
########## 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 Review comment: This is a fair point. TBH I don't think this method deserves to exist anymore at all and can just be folded into `close` where a bunch of similar blocks already exist. There's also no need to track `stopped` since `close` is only ever invoked once. I'll refactor and remove the comment entirely since everything should be more readable after that change even without commenting. ---------------------------------------------------------------- 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