Class IOStatisticsContextImpl
java.lang.Object
org.apache.hadoop.fs.statistics.impl.IOStatisticsContextImpl
- All Implemented Interfaces:
IOStatisticsContext,IOStatisticsSource
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 Summary
Constructors -
Method Summary
-
Constructor Details
-
IOStatisticsContextImpl
public IOStatisticsContextImpl(long threadId, long id) Constructor.- Parameters:
threadId- thread IDid- instance ID.
-
-
Method Details
-
toString
-
getAggregator
Get the IOStatisticsAggregator of the context.- Specified by:
getAggregatorin interfaceIOStatisticsContext- Returns:
- the instance of IOStatisticsAggregator for this context.
-
snapshot
Returns a snapshot of the current thread's IOStatistics.- Specified by:
snapshotin interfaceIOStatisticsContext- Returns:
- IOStatisticsSnapshot of the context.
-
reset
public void reset()Reset the thread +.- Specified by:
resetin interfaceIOStatisticsContext
-
getIOStatistics
Description copied from interface:IOStatisticsSourceReturn 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:
getIOStatisticsin interfaceIOStatisticsSource- Returns:
- an IOStatistics instance or null
-
getID
public long getID()ID of this context.- Specified by:
getIDin interfaceIOStatisticsContext- Returns:
- ID.
-
getThreadID
public long getThreadID()Get the thread ID.- Returns:
- thread ID.
-