lhotari commented on code in PR #4243:
URL: https://github.com/apache/bookkeeper/pull/4243#discussion_r2046220631


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/KeyValueStorageRocksDB.java:
##########
@@ -285,41 +290,57 @@ private RocksDB initializeRocksDBWithBookieConf(String 
basePath, String subPath,
 
     @Override
     public void close() throws IOException {
-        db.close();
-        if (cache != null) {
-            cache.close();
-        }
-        if (options != null) {
-            options.close();
-        }
-        optionSync.close();
-        optionDontSync.close();
-        optionCache.close();
-        optionDontCache.close();
-        emptyBatch.close();
+        writeLock.lock();
+        try {
+            closed = true;
+            db.close();
+            if (cache != null) {
+                cache.close();
+            }
+            if (options != null) {
+                options.close();
+            }
+            optionSync.close();
+            optionDontSync.close();
+            optionCache.close();
+            optionDontCache.close();
+            emptyBatch.close();
+        } finally {
+            writeLock.unlock();
+        }
     }
 
     @Override
     public void put(byte[] key, byte[] value) throws IOException {
+        readLock.lock();

Review Comment:
   @AnonHxy It seems that a StampedLock could be sufficient here since there 
doesn't seem to be a need for re-entrancy of the lock. @merlimat would using a 
StampedLock address your concern?



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