Class DurationInfo

java.lang.Object
org.apache.hadoop.util.OperationDuration
org.apache.hadoop.util.DurationInfo
All Implemented Interfaces:
AutoCloseable

@Public @Unstable public class DurationInfo extends OperationDuration implements AutoCloseable
A duration with logging of final state at info or debug in the close() call. This allows it to be used in a try-with-resources clause, and have the duration automatically logged.
  • Constructor Details

    • DurationInfo

      public DurationInfo(org.slf4j.Logger log, String format, Object... args)
      Create the duration text from a String.format() code call; log output at info level.
      Parameters:
      log - log to write to
      format - format string
      args - list of arguments
    • DurationInfo

      public DurationInfo(org.slf4j.Logger log, boolean logAtInfo, String format, Object... args)
      Create the duration text from a String.format() code call and log either at info or debug.
      Parameters:
      log - log to write to
      logAtInfo - should the log be at info, rather than debug
      format - format string
      args - list of arguments
  • Method Details