steveloughran commented on a change in pull request #2971:
URL: https://github.com/apache/hadoop/pull/2971#discussion_r819669730
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/statistics/impl/IOStatisticsBinding.java
##########
@@ -450,12 +451,37 @@ public static void maybeUpdateMinimum(AtomicLong dest,
long sample) {
* @param factory factory of duration trackers
* @param statistic statistic key
* @param input input callable.
+ * @throws IOException IO failure.
*/
public static void trackDurationOfInvocation(
DurationTrackerFactory factory,
String statistic,
InvocationRaisingIOE input) throws IOException {
+ measureDurationOfInvocation(factory, statistic, input);
+ }
+
+ /**
+ * Given an IOException raising callable/lambda expression,
+ * execute it and update the relevant statistic,
+ * returning the measured duration.
+ *
+ * {@link #trackDurationOfInvocation(DurationTrackerFactory, String,
InvocationRaisingIOE)}
+ * with the duration returned for logging etc.; added as a new
+ * method to avoid linking problems with any code calling the existing
+ * method.
+ *
+ * @param factory factory of duration trackers
+ * @param statistic statistic key
+ * @param input input callable.
+ * @return the duration of the operation, as measured by the duration
tracker.
+ * @throws IOException IO failure.
+ */
+ public static Duration measureDurationOfInvocation(
Review comment:
good q. most of the time we don't care about the result.
I'd have just added it as the return value -but as that is an incompatible
signature change at the binary level, left alone.
marking it as deprecated would be fairly needless as the old one matches the
requirements of all its existing uses
--
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]