anshul35 commented on code in PR #17492:
URL: https://github.com/apache/kafka/pull/17492#discussion_r1801016741


##########
storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/TopicBasedRemoteLogMetadataManager.java:
##########
@@ -567,9 +567,9 @@ public TopicBasedRemoteLogMetadataManagerConfig config() {
     public void close() throws IOException {
         // Close all the resources.
         log.info("Closing topic-based RLMM resources");
-        if (closing.compareAndSet(false, true)) {
-            lock.writeLock().lock();
-            try {
+        lock.writeLock().lock();

Review Comment:
   yes, you are right. We can avoid taking lock in close method.
   
   After setting closing to true there are 2 cases: 
   
   1. initializationThread is null -> In this case, we won't wait for this to 
complete. Because closing = true will prevent initializationThread from 
creating any resources.
   2. initializationThread is not null -> In this case we will wait for 
completion of initializationThread.



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

Reply via email to