public abstract class ObjectInputStream
extends org.apache.hadoop.fs.FSInputStream
implements org.apache.hadoop.fs.StreamCapabilities, org.apache.hadoop.fs.statistics.IOStatisticsSource
The base class includes common methods, stores common data and incorporates leak tracking.
| Modifier | Constructor and Description |
|---|---|
protected |
ObjectInputStream(InputStreamType streamType,
ObjectReadParameters parameters)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
abortInFinalizer()
Brute force stream close; invoked by
LeakReporter. |
void |
close()
Close the stream.
|
protected void |
finalize()
Finalizer.
|
protected ExecutorService |
getBoundedThreadPool()
Thread pool used for bounded IO operations.
|
protected String |
getBucket()
Store bucket.
|
protected ObjectInputStreamCallbacks |
getCallbacks()
Callbacks for reading input stream data from the S3 Store.
|
protected long |
getContentLength()
Content length from HEAD or openFile option.
|
protected S3AReadOpContext |
getContext()
Read-specific operation context structure.
|
S3AInputPolicy |
getInputPolicy()
Get the current input policy.
|
org.apache.hadoop.fs.statistics.IOStatistics |
getIOStatistics() |
protected String |
getKey()
Store key.
|
protected S3ObjectAttributes |
getObjectAttributes()
Attributes of the remote object.
|
protected String |
getPathStr()
Path URI as a string.
|
S3AInputStreamStatistics |
getS3AStreamStatistics()
Access the input stream statistics.
|
protected org.apache.hadoop.fs.statistics.IOStatisticsAggregator |
getThreadIOStatistics()
Aggregator used to aggregate per thread IOStatistics.
|
protected String |
getUri()
URI of path.
|
protected VectoredIOContext |
getVectoredIOContext()
Get Vectored IO context.
|
boolean |
hasCapability(String capability)
Declare the base capabilities implemented by this class and so by
all subclasses.
|
protected abstract boolean |
isStreamOpen()
Probe for stream being open.
|
int |
maxReadSizeForVectorReads()
.
|
protected void |
mergeThreadIOStatistics(org.apache.hadoop.fs.statistics.IOStatistics streamIOStats)
Merging the current thread's IOStatistics with the current IOStatistics
context.
|
int |
minSeekForVectorReads()
.
|
protected void |
setInputPolicy(S3AInputPolicy inputPolicy)
Set/update the input policy of the stream.
|
InputStreamType |
streamType() |
String |
toString() |
getPos, read, readFully, readFully, seek, seekToNewSource, validatePositionedReadArgsavailable, mark, markSupported, read, read, read, reset, skipprotected ObjectInputStream(InputStreamType streamType, ObjectReadParameters parameters)
streamType - stream type enum.parameters - extensible parameter list.protected abstract boolean isStreamOpen()
protected abstract void abortInFinalizer()
LeakReporter.
All exceptions raised are ignored.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOException - on any problemprotected void mergeThreadIOStatistics(org.apache.hadoop.fs.statistics.IOStatistics streamIOStats)
streamIOStats - Stream statistics to be merged into thread
statistics aggregator.protected void finalize()
throws Throwable
Verify that the inner stream is closed.
If it is not, it means streams are being leaked in application code. Log a warning, including the stack trace of the caller, then abort the stream.
This does not attempt to invoke close() as that is
a more complex operation, and this method is being executed
during a GC finalization phase.
Applications MUST close their streams; this is a defensive operation to return http connections and warn the end users that their applications are at risk of running out of connections.
@VisibleForTesting public S3AInputPolicy getInputPolicy()
protected void setInputPolicy(S3AInputPolicy inputPolicy)
inputPolicy - new input policy.@InterfaceAudience.Private @InterfaceStability.Unstable @VisibleForTesting public S3AInputStreamStatistics getS3AStreamStatistics()
public org.apache.hadoop.fs.statistics.IOStatistics getIOStatistics()
getIOStatistics in interface org.apache.hadoop.fs.statistics.IOStatisticsSourcepublic boolean hasCapability(String capability)
Subclasses MUST override this if they add more capabilities, or actually remove any of these.
hasCapability in interface org.apache.hadoop.fs.StreamCapabilitiescapability - string to query the stream support for.protected final S3AReadOpContext getContext()
protected final ObjectInputStreamCallbacks getCallbacks()
protected final ExecutorService getBoundedThreadPool()
protected final String getUri()
protected final String getBucket()
protected final String getKey()
protected final String getPathStr()
protected final long getContentLength()
protected final org.apache.hadoop.fs.statistics.IOStatisticsAggregator getThreadIOStatistics()
protected final S3ObjectAttributes getObjectAttributes()
protected VectoredIOContext getVectoredIOContext()
public int minSeekForVectorReads()
minSeekForVectorReads in interface org.apache.hadoop.fs.PositionedReadablepublic int maxReadSizeForVectorReads()
maxReadSizeForVectorReads in interface org.apache.hadoop.fs.PositionedReadablepublic InputStreamType streamType()
public String toString()
toString in class org.apache.hadoop.fs.FSInputStreamCopyright © 2008–2025 Apache Software Foundation. All rights reserved.