tanvipenumudy commented on code in PR #3271:
URL: https://github.com/apache/ozone/pull/3271#discussion_r845796475
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/lock/OzoneManagerLock.java:
##########
@@ -514,29 +615,56 @@ public void cleanup() {
// Name of the resource.
private String name;
- // This helps in maintaining lock related variables locally confined to a
- // given thread.
+ // This helps in maintaining read lock related variables locally confined
+ // to a given thread.
private final ThreadLocal<LockUsageInfo> readLockTimeStampNanos =
ThreadLocal.withInitial(LockUsageInfo::new);
+ // This helps in maintaining write lock related variables locally confined
+ // to a given thread.
+ private final ThreadLocal<LockUsageInfo> writeLockTimeStampNanos =
+ ThreadLocal.withInitial(LockUsageInfo::new);
+
/**
- * Sets the time (ns) when the lock holding period begins specific to a
+ * Sets the time (ns) when the read lock holding period begins specific to
a
* thread.
*
- * @param startHeldTimeNanos lock held start time (ns)
+ * @param startReadHeldTimeNanos read lock held start time (ns)
*/
- void setStartHeldTimeNanos(long startHeldTimeNanos) {
- readLockTimeStampNanos.get().setStartHeldTimeNanos(startHeldTimeNanos);
+ void setStartReadHeldTimeNanos(long startReadHeldTimeNanos) {
+ readLockTimeStampNanos.get()
+ .setStartReadHeldTimeNanos(startReadHeldTimeNanos);
}
/**
- * Returns the time (ns) when the lock holding period began specific to a
- * thread.
+ * Sets the time (ns) when the write lock holding period begins specific to
+ * a thread.
+ *
+ * @param startWriteHeldTimeNanos write lock held start time (ns)
+ */
+ void setStartWriteHeldTimeNanos(long startWriteHeldTimeNanos) {
+ writeLockTimeStampNanos.get()
+ .setStartWriteHeldTimeNanos(startWriteHeldTimeNanos);
+ }
+
+ /**
+ * Returns the time (ns) when the read lock holding period began specific
to
+ * a thread.
+ *
+ * @return read lock held start time (ns)
+ */
+ long getStartReadHeldTimeNanos() {
+ return readLockTimeStampNanos.get().getStartReadHeldTimeNanos();
+ }
+
+ /**
+ * Returns the time (ns) when the write lock holding period began specific
+ * to a thread.
*
- * @return lock held start time (ns)
+ * @return write lock held start time (ns)
*/
- long getStartHeldTimeNanos() {
- return readLockTimeStampNanos.get().getStartHeldTimeNanos();
+ long getStartWriteHeldTimeNanos() {
+ return writeLockTimeStampNanos.get().getStartWriteHeldTimeNanos();
Review Comment:
Made the changes, thank you!
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/lock/OzoneManagerLock.java:
##########
@@ -514,29 +615,56 @@ public void cleanup() {
// Name of the resource.
private String name;
- // This helps in maintaining lock related variables locally confined to a
- // given thread.
+ // This helps in maintaining read lock related variables locally confined
+ // to a given thread.
private final ThreadLocal<LockUsageInfo> readLockTimeStampNanos =
ThreadLocal.withInitial(LockUsageInfo::new);
+ // This helps in maintaining write lock related variables locally confined
+ // to a given thread.
+ private final ThreadLocal<LockUsageInfo> writeLockTimeStampNanos =
+ ThreadLocal.withInitial(LockUsageInfo::new);
+
/**
- * Sets the time (ns) when the lock holding period begins specific to a
+ * Sets the time (ns) when the read lock holding period begins specific to
a
* thread.
*
- * @param startHeldTimeNanos lock held start time (ns)
+ * @param startReadHeldTimeNanos read lock held start time (ns)
*/
- void setStartHeldTimeNanos(long startHeldTimeNanos) {
- readLockTimeStampNanos.get().setStartHeldTimeNanos(startHeldTimeNanos);
+ void setStartReadHeldTimeNanos(long startReadHeldTimeNanos) {
+ readLockTimeStampNanos.get()
+ .setStartReadHeldTimeNanos(startReadHeldTimeNanos);
}
/**
- * Returns the time (ns) when the lock holding period began specific to a
- * thread.
+ * Sets the time (ns) when the write lock holding period begins specific to
+ * a thread.
+ *
+ * @param startWriteHeldTimeNanos write lock held start time (ns)
+ */
+ void setStartWriteHeldTimeNanos(long startWriteHeldTimeNanos) {
+ writeLockTimeStampNanos.get()
+ .setStartWriteHeldTimeNanos(startWriteHeldTimeNanos);
+ }
+
+ /**
+ * Returns the time (ns) when the read lock holding period began specific
to
+ * a thread.
+ *
+ * @return read lock held start time (ns)
+ */
+ long getStartReadHeldTimeNanos() {
+ return readLockTimeStampNanos.get().getStartReadHeldTimeNanos();
Review Comment:
Made the changes, thank you!
--
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]