rakeshadr commented on a change in pull request #3180:
URL: https://github.com/apache/ozone/pull/3180#discussion_r824424519
##########
File path:
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/LockManager.java
##########
@@ -234,4 +234,17 @@ private void decrementActiveLockCount(final R resource) {
});
}
+ /**
+ * Returns the active lock count on a given resource.
+ *
+ * @param resource for which the active lock count has to be returned
+ * @return active lock count
+ */
+ public int getActiveLockCount(final R resource) {
+ ActiveLock activeLock = activeLocks.get(resource);
+ if (activeLock != null) {
+ return activeLock.getActiveLockCount();
+ }
+ return 0;
Review comment:
Since the metrics is getting updated on `holdCount == 0`, please return
-1 for null active lock case
--
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]