Class IOTraceMonitor

java.lang.Object
org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter
org.apache.jackrabbit.oak.segment.tool.iotrace.IOTraceMonitor
All Implemented Interfaces:
Flushable, IOMonitor

public class IOTraceMonitor extends IOMonitorAdapter implements Flushable
This implementation of a IOMonitor logs all io reads to an underlying IOTraceWriter.
  • Constructor Details

    • IOTraceMonitor

      public IOTraceMonitor(@NotNull @NotNull IOTraceWriter traceWriter, @Nullable @Nullable String contextSpec)
      Create a new instance writing to traceWriter with additional context fields.
      Parameters:
      traceWriter - the IOTraceWriter
      contextSpec - additional context fields. A comma separated string.
    • IOTraceMonitor

      public IOTraceMonitor(@NotNull @NotNull IOTraceWriter traceWriter)
      Create a new instance writing to traceWriter additional context fields context.
      Parameters:
      traceWriter - the IOTraceWriter
  • Method Details

    • setContext

      public void setContext(@NotNull @NotNull List<String> context)
      Set the current context.
      Parameters:
      context - a list of strings corresponding to the fields passed to the contextSpec argument in the constructor.
    • afterSegmentRead

      public void afterSegmentRead(@NotNull @NotNull File file, long msb, long lsb, int length, long elapsed)
      Description copied from interface: IOMonitor
      Called after a segment is read from the file system. This is called only in case of successful operations.
      Specified by:
      afterSegmentRead in interface IOMonitor
      Overrides:
      afterSegmentRead in class IOMonitorAdapter
      Parameters:
      file - File containing the segment.
      msb - Most significant bits of the segment ID.
      lsb - Least significant bits of the segment ID.
      length - Size of the segment.
      elapsed - Time spent by the read operation, in nanoseconds.
    • flush

      public void flush()
      Specified by:
      flush in interface Flushable