Package org.apache.hadoop.fs.statistics
Interface DurationTracker
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
StatisticDurationTracker,StubDurationTracker
Interface to be implemented by objects which can track duration.
It extends AutoCloseable to fit into a try-with-resources statement,
but then strips out the
throws Exception aspect of the signature
so it doesn't force code to add extra handling for any failures.
If a duration is declared as "failed()" then the failure counters
will be updated.-
Method Details
-
failed
void failed()The operation failed. Failure statistics will be updated. -
close
void close()Finish tracking: update the statistics with the timings.- Specified by:
closein interfaceAutoCloseable
-
asDuration
Get the duration of an operation as a java Duration instance. If the duration tracker hasn't completed, or its duration tracking doesn't actually measure duration, returns Duration.ZERO.- Returns:
- a duration, value of ZERO until close().
-