Class IOStatisticsContextImpl

java.lang.Object
org.apache.hadoop.fs.statistics.impl.IOStatisticsContextImpl
All Implemented Interfaces:
IOStatisticsContext, IOStatisticsSource

public final class IOStatisticsContextImpl extends Object implements IOStatisticsContext
Implementing the IOStatisticsContext. A Context defined for IOStatistics collection per thread which captures each worker thread's work in FS streams and stores it in the form of IOStatisticsSnapshot. For the current thread the IOStatisticsSnapshot can be used as a way to move the IOStatistics data between applications using the Serializable nature of the class.
  • Constructor Details

    • IOStatisticsContextImpl

      public IOStatisticsContextImpl(long threadId, long id)
      Constructor.
      Parameters:
      threadId - thread ID
      id - instance ID.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAggregator

      public IOStatisticsAggregator getAggregator()
      Get the IOStatisticsAggregator of the context.
      Specified by:
      getAggregator in interface IOStatisticsContext
      Returns:
      the instance of IOStatisticsAggregator for this context.
    • snapshot

      public IOStatisticsSnapshot snapshot()
      Returns a snapshot of the current thread's IOStatistics.
      Specified by:
      snapshot in interface IOStatisticsContext
      Returns:
      IOStatisticsSnapshot of the context.
    • reset

      public void reset()
      Reset the thread +.
      Specified by:
      reset in interface IOStatisticsContext
    • getIOStatistics

      public IOStatistics getIOStatistics()
      Description copied from interface: IOStatisticsSource
      Return a statistics instance.

      It is not a requirement that the same instance is returned every time. IOStatisticsSource.

      If the object implementing this is Closeable, this method may return null if invoked on a closed object, even if it returns a valid instance when called earlier.

      Specified by:
      getIOStatistics in interface IOStatisticsSource
      Returns:
      an IOStatistics instance or null
    • getID

      public long getID()
      ID of this context.
      Specified by:
      getID in interface IOStatisticsContext
      Returns:
      ID.
    • getThreadID

      public long getThreadID()
      Get the thread ID.
      Returns:
      thread ID.