Class DynamicWrappedStatistics
java.lang.Object
org.apache.hadoop.io.wrappedio.impl.DynamicWrappedStatistics
The wrapped IOStatistics methods in
WrappedStatistics,
dynamically loaded.
This is suitable for copy-and-paste into other libraries which have some
version of the Parquet DynMethods classes already present.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringIOStatisticsContext method: "iostatisticsContext_aggregate".static final StringIOStatisticsContext method: "iostatisticsContext_enabled".static final StringIOStatisticsContext method: "iostatisticsContext_getCurrent".static final StringIOStatisticsContext method: "iostatisticsContext_reset".static final StringIOStatisticsContext method: "iostatisticsContext_setThreadIOStatisticsContext".static final StringIOStatisticsContext method: "iostatisticsContext_snapshot".static final StringMethod name: "iostatistics_counters".static final StringMethod name: "iostatistics_gauges".static final StringMethod name: "iostatistics_maximums".static final StringMethod name: "iostatistics_means".static final StringMethod name: "iostatistics_minimums".static final StringMethod name: "iostatisticsSnapshot_aggregate".static final StringMethod name: "iostatisticsSnapshot_create".static final StringMethod name: "iostatisticsSnapshot_fromJsonString".static final StringMethod name: "iostatisticsSnapshot_load".static final StringMethod name: "iostatisticsSnapshot_retrieve".static final StringMethod name: "iostatisticsSnapshot_save".static final StringMethod name: "iostatisticsSnapshot_toJsonString".static final StringMethod name: "iostatistics_toPrettyString".static final StringMethod name: "isIOStatistics".static final StringMethod name: "isIOStatisticsSnapshot".static final StringMethod name: "isIOStatisticsSource".static final StringClassname of the wrapped statistics class: "org.apache.hadoop.io.wrappedio.WrappedStatistics". -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioniostatistics_counters(Serializable source) Get the counters of an IOStatisticsSnapshot.iostatistics_gauges(Serializable source) Get the gauges of an IOStatisticsSnapshot.iostatistics_maximums(Serializable source) Get the maximums of an IOStatisticsSnapshot.iostatistics_means(Serializable source) Get the means of an IOStatisticsSnapshot.iostatistics_minimums(Serializable source) Get the minimums of an IOStatisticsSnapshot.iostatistics_toPrettyString(Object statistics) Convert IOStatistics to a string form, with all the metrics sorted and empty value stripped.booleanAre the core IOStatistics methods and classes available.booleaniostatisticsContext_aggregate(Object source) Aggregate into the IOStatistics context the statistics passed in via IOStatistics/source parameter.booleanProbe to check if the thread-level IO statistics enabled.Get the context'sIOStatisticsContextwhich implementsIOStatisticsSource.voidReset the context's IOStatistics.voidiostatisticsContext_setThreadIOStatisticsContext(Object statisticsContext) Set the IOStatisticsContext for the current thread.Take a snapshot of the context IOStatistics.booleanAre the IOStatisticsContext methods and classes available?booleaniostatisticsSnapshot_aggregate(Serializable snapshot, Object statistics) Aggregate an existingIOStatisticsSnapshotwith the supplied statistics.Create a newIOStatisticsSnapshotinstance.iostatisticsSnapshot_create(Object source) Create a newIOStatisticsSnapshotinstance.Load IOStatisticsSnapshot from a JSON string.iostatisticsSnapshot_load(FileSystem fs, Path path) Load IOStatisticsSnapshot from a Hadoop filesystem.iostatisticsSnapshot_retrieve(Object source) Extract the IOStatistics from an object in a serializable form.voidiostatisticsSnapshot_save(Serializable snapshot, FileSystem fs, Path path, boolean overwrite) Save IOStatisticsSnapshot to a Hadoop filesystem as a JSON file.Save IOStatisticsSnapshot to a JSON string.booleanisIOStatistics(Object object) Probe for an object being an instance ofIOStatisticsSource.booleanisIOStatisticsSnapshot(Serializable object) Probe for an object being an instance ofIOStatisticsSnapshot.booleanisIOStatisticsSource(Object object) Probe for an object being an instance ofIOStatisticsSource.booleanloaded()Is the wrapped statistics class loaded?toString()
-
Field Details
-
WRAPPED_STATISTICS_CLASSNAME
Classname of the wrapped statistics class: "org.apache.hadoop.io.wrappedio.WrappedStatistics".- See Also:
-
IS_IOSTATISTICS_SOURCE
Method name: "isIOStatisticsSource".- See Also:
-
IS_IOSTATISTICS
Method name: "isIOStatistics".- See Also:
-
IS_IOSTATISTICS_SNAPSHOT
Method name: "isIOStatisticsSnapshot".- See Also:
-
IOSTATISTICS_CONTEXT_AGGREGATE
IOStatisticsContext method: "iostatisticsContext_aggregate".- See Also:
-
IOSTATISTICS_CONTEXT_ENABLED
IOStatisticsContext method: "iostatisticsContext_enabled".- See Also:
-
IOSTATISTICS_CONTEXT_GET_CURRENT
IOStatisticsContext method: "iostatisticsContext_getCurrent".- See Also:
-
IOSTATISTICS_CONTEXT_SET_THREAD_CONTEXT
IOStatisticsContext method: "iostatisticsContext_setThreadIOStatisticsContext".- See Also:
-
IOSTATISTICS_CONTEXT_RESET
IOStatisticsContext method: "iostatisticsContext_reset".- See Also:
-
IOSTATISTICS_CONTEXT_SNAPSHOT
IOStatisticsContext method: "iostatisticsContext_snapshot".- See Also:
-
IOSTATISTICS_SNAPSHOT_AGGREGATE
Method name: "iostatisticsSnapshot_aggregate".- See Also:
-
IOSTATISTICS_SNAPSHOT_CREATE
Method name: "iostatisticsSnapshot_create".- See Also:
-
IOSTATISTICS_SNAPSHOT_FROM_JSON_STRING
Method name: "iostatisticsSnapshot_fromJsonString".- See Also:
-
IOSTATISTICS_SNAPSHOT_LOAD
Method name: "iostatisticsSnapshot_load".- See Also:
-
IOSTATISTICS_SNAPSHOT_RETRIEVE
Method name: "iostatisticsSnapshot_retrieve".- See Also:
-
IOSTATISTICS_SNAPSHOT_SAVE
Method name: "iostatisticsSnapshot_save".- See Also:
-
IOSTATISTICS_SNAPSHOT_TO_JSON_STRING
Method name: "iostatisticsSnapshot_toJsonString".- See Also:
-
IOSTATISTICS_TO_PRETTY_STRING
Method name: "iostatistics_toPrettyString".- See Also:
-
IOSTATISTICS_COUNTERS
Method name: "iostatistics_counters".- See Also:
-
IOSTATISTICS_GAUGES
Method name: "iostatistics_gauges".- See Also:
-
IOSTATISTICS_MINIMUMS
Method name: "iostatistics_minimums".- See Also:
-
IOSTATISTICS_MAXIMUMS
Method name: "iostatistics_maximums".- See Also:
-
IOSTATISTICS_MEANS
Method name: "iostatistics_means".- See Also:
-
-
Constructor Details
-
DynamicWrappedStatistics
public DynamicWrappedStatistics() -
DynamicWrappedStatistics
-
-
Method Details
-
loaded
public boolean loaded()Is the wrapped statistics class loaded?- Returns:
- true if the wrappedIO class was found and loaded.
-
ioStatisticsAvailable
public boolean ioStatisticsAvailable()Are the core IOStatistics methods and classes available.- Returns:
- true if the relevant methods are loaded.
-
ioStatisticsContextAvailable
public boolean ioStatisticsContextAvailable()Are the IOStatisticsContext methods and classes available?- Returns:
- true if the relevant methods are loaded.
-
isIOStatisticsSource
Probe for an object being an instance ofIOStatisticsSource.- Parameters:
object- object to probe- Returns:
- true if the object is the right type, false if the classes were not found or the object is null/of a different type
-
isIOStatistics
Probe for an object being an instance ofIOStatisticsSource.- Parameters:
object- object to probe- Returns:
- true if the object is the right type, false if the classes were not found or the object is null/of a different type
-
isIOStatisticsSnapshot
Probe for an object being an instance ofIOStatisticsSnapshot.- Parameters:
object- object to probe- Returns:
- true if the object is the right type, false if the classes were not found or the object is null/of a different type
-
iostatisticsContext_enabled
public boolean iostatisticsContext_enabled()Probe to check if the thread-level IO statistics enabled. If the relevant classes and methods were not found, returns false- Returns:
- true if the IOStatisticsContext API was found and is enabled.
-
iostatisticsContext_getCurrent
Get the context'sIOStatisticsContextwhich implementsIOStatisticsSource. This is either a thread-local value or a global empty context.- Returns:
- instance of
IOStatisticsContext. - Throws:
UnsupportedOperationException- if the IOStatisticsContext API was not found
-
iostatisticsContext_setThreadIOStatisticsContext
public void iostatisticsContext_setThreadIOStatisticsContext(@Nullable Object statisticsContext) throws UnsupportedOperationException Set the IOStatisticsContext for the current thread.- Parameters:
statisticsContext- IOStatistics context instance for the current thread. If null, the context is reset.- Throws:
UnsupportedOperationException- if the IOStatisticsContext API was not found
-
iostatisticsContext_reset
Reset the context's IOStatistics.IOStatisticsContext#reset()- Throws:
UnsupportedOperationException- if the IOStatisticsContext API was not found
-
iostatisticsContext_snapshot
Take a snapshot of the context IOStatistics.IOStatisticsContext#snapshot()- Returns:
- an instance of
IOStatisticsSnapshot. - Throws:
UnsupportedOperationException- if the IOStatisticsContext API was not found
-
iostatisticsContext_aggregate
Aggregate into the IOStatistics context the statistics passed in via IOStatistics/source parameter.Returns false if the source is null or does not contain any statistics.
- Parameters:
source- implementation ofIOStatisticsSourceorIOStatistics- Returns:
- true if the the source object was aggregated.
-
iostatisticsSnapshot_aggregate
public boolean iostatisticsSnapshot_aggregate(Serializable snapshot, @Nullable Object statistics) throws UnsupportedOperationException Aggregate an existingIOStatisticsSnapshotwith the supplied statistics.- Parameters:
snapshot- snapshot to updatestatistics- IOStatistics to add- Returns:
- true if the snapshot was updated.
- Throws:
IllegalArgumentException- if thestatisticsargument is not null but not an instance of IOStatistics, or ifsnapshotis invalid.UnsupportedOperationException- if the IOStatistics classes were not found
-
iostatisticsSnapshot_create
Create a newIOStatisticsSnapshotinstance.- Returns:
- an empty IOStatisticsSnapshot.
- Throws:
UnsupportedOperationException- if the IOStatistics classes were not found
-
iostatisticsSnapshot_create
public Serializable iostatisticsSnapshot_create(@Nullable Object source) throws UnsupportedOperationException, ClassCastException Create a newIOStatisticsSnapshotinstance.- Parameters:
source- optional source statistics- Returns:
- an IOStatisticsSnapshot.
- Throws:
ClassCastException- if thesourceis not valid.UnsupportedOperationException- if the IOStatistics classes were not found
-
iostatisticsSnapshot_toJsonString
public String iostatisticsSnapshot_toJsonString(@Nullable Serializable snapshot) throws UncheckedIOException, UnsupportedOperationException Save IOStatisticsSnapshot to a JSON string.- Parameters:
snapshot- statistics; may be null or of an incompatible type- Returns:
- JSON string value or null if source is not an IOStatisticsSnapshot
- Throws:
UncheckedIOException- Any IO/jackson exception.UnsupportedOperationException- if the IOStatistics classes were not found
-
iostatisticsSnapshot_fromJsonString
public Serializable iostatisticsSnapshot_fromJsonString(String json) throws UncheckedIOException, UnsupportedOperationException Load IOStatisticsSnapshot from a JSON string.- Parameters:
json- JSON string value.- Returns:
- deserialized snapshot.
- Throws:
UncheckedIOException- Any IO/jackson exception.UnsupportedOperationException- if the IOStatistics classes were not found
-
iostatisticsSnapshot_load
public Serializable iostatisticsSnapshot_load(FileSystem fs, Path path) throws UncheckedIOException, UnsupportedOperationException Load IOStatisticsSnapshot from a Hadoop filesystem.- Parameters:
fs- filesystempath- path- Returns:
- the loaded snapshot
- Throws:
UncheckedIOException- Any IO exception.UnsupportedOperationException- if the IOStatistics classes were not found
-
iostatisticsSnapshot_retrieve
public Serializable iostatisticsSnapshot_retrieve(@Nullable Object source) throws UnsupportedOperationException Extract the IOStatistics from an object in a serializable form.- Parameters:
source- source object, may be null/not a statistics source/instance- Returns:
IOStatisticsSnapshotor null if the object is null/doesn't have statistics- Throws:
UnsupportedOperationException- if the IOStatistics classes were not found
-
iostatisticsSnapshot_save
public void iostatisticsSnapshot_save(@Nullable Serializable snapshot, FileSystem fs, Path path, boolean overwrite) throws UncheckedIOException, UnsupportedOperationException Save IOStatisticsSnapshot to a Hadoop filesystem as a JSON file.- Parameters:
snapshot- statisticsfs- filesystempath- pathoverwrite- should any existing file be overwritten?- Throws:
UncheckedIOException- Any IO exception.UnsupportedOperationException- if the IOStatistics classes were not found
-
iostatistics_counters
Get the counters of an IOStatisticsSnapshot.- Parameters:
source- source of statistics.- Returns:
- the map of counters.
-
iostatistics_gauges
Get the gauges of an IOStatisticsSnapshot.- Parameters:
source- source of statistics.- Returns:
- the map of gauges.
-
iostatistics_minimums
Get the minimums of an IOStatisticsSnapshot.- Parameters:
source- source of statistics.- Returns:
- the map of minimums.
-
iostatistics_maximums
Get the maximums of an IOStatisticsSnapshot.- Parameters:
source- source of statistics.- Returns:
- the map of maximums.
-
iostatistics_means
Get the means of an IOStatisticsSnapshot. Each value in the map is the (sample, sum) tuple of the values; the mean is then calculated by dividing sum/sample wherever sample is non-zero.- Parameters:
source- source of statistics.- Returns:
- a map of mean key to (sample, sum) tuples.
-
iostatistics_toPrettyString
Convert IOStatistics to a string form, with all the metrics sorted and empty value stripped.- Parameters:
statistics- A statistics instance.- Returns:
- string value or the empty string if null
- Throws:
UnsupportedOperationException- if the IOStatistics classes were not found
-
toString
-