Class IOTraceMonitor
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter
-
- org.apache.jackrabbit.oak.segment.tool.iotrace.IOTraceMonitor
-
- All Implemented Interfaces:
java.io.Flushable
,IOMonitor
public class IOTraceMonitor extends IOMonitorAdapter implements java.io.Flushable
This implementation of aIOMonitor
logs all io reads to an underlyingIOTraceWriter
.
-
-
Constructor Summary
Constructors Constructor Description IOTraceMonitor(@NotNull IOTraceWriter traceWriter)
Create a new instance writing totraceWriter
additional context fields context.IOTraceMonitor(@NotNull IOTraceWriter traceWriter, @Nullable java.lang.String contextSpec)
Create a new instance writing totraceWriter
with additional context fields.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterSegmentRead(@NotNull java.io.File file, long msb, long lsb, int length, long elapsed)
Called after a segment is read from the file system.void
flush()
void
setContext(@NotNull java.util.List<java.lang.String> context)
Set the current context.-
Methods inherited from class org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter
afterSegmentWrite, beforeSegmentRead, beforeSegmentWrite
-
-
-
-
Constructor Detail
-
IOTraceMonitor
public IOTraceMonitor(@NotNull @NotNull IOTraceWriter traceWriter, @Nullable @Nullable java.lang.String contextSpec)
Create a new instance writing totraceWriter
with additional context fields.- Parameters:
traceWriter
- theIOTraceWriter
contextSpec
- additional context fields. A comma separated string.
-
IOTraceMonitor
public IOTraceMonitor(@NotNull @NotNull IOTraceWriter traceWriter)
Create a new instance writing totraceWriter
additional context fields context.- Parameters:
traceWriter
- theIOTraceWriter
-
-
Method Detail
-
setContext
public void setContext(@NotNull @NotNull java.util.List<java.lang.String> context)
Set the current context.- Parameters:
context
- a list of strings corresponding to the fields passed to thecontextSpec
argument in the constructor.
-
afterSegmentRead
public void afterSegmentRead(@NotNull @NotNull java.io.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 interfaceIOMonitor
- Overrides:
afterSegmentRead
in classIOMonitorAdapter
- 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 interfacejava.io.Flushable
-
-