Package org.apache.hadoop.fs.s3a.impl
Class SDKStreamDrainer<TStream extends InputStream & software.amazon.awssdk.http.Abortable>
java.lang.Object
org.apache.hadoop.fs.s3a.impl.SDKStreamDrainer<TStream>
- All Implemented Interfaces:
org.apache.hadoop.util.functional.CallableRaisingIOE<Boolean>
public class SDKStreamDrainer<TStream extends InputStream & software.amazon.awssdk.http.Abortable>
extends Object
implements org.apache.hadoop.util.functional.CallableRaisingIOE<Boolean>
Drains/aborts s3 or other AWS SDK streams.
It is callable so can be passed directly to a submitter
for async invocation.
-
Constructor Summary
ConstructorsConstructorDescriptionSDKStreamDrainer(String uri, TStream sdkStream, boolean shouldAbort, int remaining, S3AInputStreamStatistics streamStatistics, String reason) Prepare to drain the stream. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.util.functional.CallableRaisingIOE
unchecked
-
Constructor Details
-
SDKStreamDrainer
public SDKStreamDrainer(String uri, TStream sdkStream, boolean shouldAbort, int remaining, S3AInputStreamStatistics streamStatistics, String reason) Prepare to drain the stream.- Parameters:
uri- URI for messagessdkStream- stream to close.shouldAbort- force an abort; used if explicitly requested.streamStatistics- stats to updatereason- reason for stream being closed; used in messagesremaining- remaining bytes
-
-
Method Details
-
apply
drain the stream. This method is intended to be used directly or asynchronously, and measures the duration of the operation in the stream statistics.- Specified by:
applyin interfaceorg.apache.hadoop.util.functional.CallableRaisingIOE<TStream extends InputStream & software.amazon.awssdk.http.Abortable>- Returns:
- was the stream aborted?
-
getUri
-
getSdkStream
-
shouldAbort
public boolean shouldAbort() -
getRemaining
public int getRemaining() -
getStreamStatistics
-
getReason
-
executed
public boolean executed() -
getThrown
-
getDrained
public int getDrained() -
aborted
public boolean aborted() -
toString
-