szetszwo commented on code in PR #10852:
URL: https://github.com/apache/ozone/pull/10852#discussion_r3641389414


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/lock/OzoneManagerLock.java:
##########
@@ -97,41 +93,172 @@ public class OzoneManagerLock implements IOzoneManagerLock 
{
   private static final Logger LOG =
       LoggerFactory.getLogger(OzoneManagerLock.class);
 
-  private final Map<Class<? extends Resource>,
-      Pair<Map<Resource, Striped<ReadWriteLock>>, ResourceLockTracker>> 
resourcelockMap;
+  private final ResourceLocks<LeveledResource> leveledResourceLocks;
+  private final ResourceLocks<DAGLeveledResource> dagLeveledResourceLocks;
 
-  private OMLockMetrics omLockMetrics;
+  private final OMLockMetrics omLockMetrics = OMLockMetrics.create();
+
+  class ResourceLocks<R extends Resource> {
+    private final Map<Resource, Striped<ReentrantReadWriteLock>> lockMap;
+    private final ResourceLockTracker<R> tracker;
+
+    class Context {
+      private final R resource;
+      private final long startWaitingTimeNanos = Time.monotonicNowNanos();
+
+      Context(R r) {
+        this.resource = r;
+      }
+
+      R getResource() {
+        return resource;
+      }
+
+      long getWaitingTimeNanos() {
+        return Time.monotonicNowNanos() - startWaitingTimeNanos;

Review Comment:
   Context is removed, so the code is reverted back as before.



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