Interface IOMonitoringContext


  • public interface IOMonitoringContext
    Provides a context for instrumenting I/O operations.
    See Also:
    IOChannelStatsCollector
    • Method Detail

      • newCollector

        IOChannelStatsCollector newCollector​(String interfaceName,
                                             IOChannelOperation op)
        Creates a new I/O statistics collector with the specified attributes. The context name of the collector is provided from the context. Typically, the interface name would be the filename (for a file channel) or network address (for a socket or datagram channel). This label does not necessarily need to be unique.
        Parameters:
        interfaceName - label used to identify statistics
        op - I/O operation being monitored (reading, writing, etc.)
        Returns:
        a new collector
      • monitorInput

        InputStream monitorInput​(InputStream in,
                                 String label)
        Instruments an existing input stream with monitoring. Reads on the resulting stream will collect performance statistics.
        Parameters:
        in - the input stream to monitor
        label - the interface name to associate with the stream
        Returns:
        a new input stream which collects performance measurements
      • monitorOutput

        OutputStream monitorOutput​(OutputStream out,
                                   String label)
        Instruments an existing input stream with monitoring. Writes on the resulting stream will collect performance statistics.
        Parameters:
        out - the output stream to monitor
        label - the interface name to associate with the stream
        Returns:
        a new output stream which collects performance measurements
      • monitorChannel

        FileChannel monitorChannel​(FileChannel ch,
                                   String label)
        Instruments an existing file channel with monitoring. Reads and writes on the resulting channel will collect performance statistics; the channel will have two separate sets of statistics, one for read and one for write.
        Parameters:
        ch - the channel to monitor
        label - the interface name to associate with the channel
        Returns:
        a new channel which collects performance measurements