smengcl commented on code in PR #7745:
URL: https://github.com/apache/ozone/pull/7745#discussion_r1929482697


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotCache.java:
##########
@@ -58,14 +65,32 @@ public class SnapshotCache implements 
ReferenceCountedCallback, AutoCloseable {
       "SnapshotCacheCleanupService";
 
   private final OMMetrics omMetrics;
+  private final ReadWriteLock lock;
+  private final Lock readLock;
+  private final Lock writeLock;
+  private int lockCnt;
+  private final Condition lockReleased;
+  private final Condition dbClosed;
+  private final long lockTimeout;
+  private final Map<Long, Map<UUID, Long>> snapshotRefThreadIds;
+  private final AtomicBoolean closed;
 
   public SnapshotCache(CacheLoader<UUID, OmSnapshot> cacheLoader, int 
cacheSizeLimit, OMMetrics omMetrics,
-                       long cleanupInterval) {
+                       long cleanupInterval, long lockTimeout) {
     this.dbMap = new ConcurrentHashMap<>();
     this.cacheLoader = cacheLoader;
     this.cacheSizeLimit = cacheSizeLimit;
     this.omMetrics = omMetrics;
     this.pendingEvictionQueue = ConcurrentHashMap.newKeySet();
+    this.lock = new ReentrantReadWriteLock();
+    this.readLock = lock.readLock();
+    this.writeLock = lock.writeLock();
+    this.snapshotRefThreadIds = new ConcurrentHashMap<>();
+    this.lockTimeout = lockTimeout;

Review Comment:
   Let's print an INFO level log here that the snapshot cache lock timeout is 
set to X ms.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to