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 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 messages
      sdkStream - stream to close.
      shouldAbort - force an abort; used if explicitly requested.
      streamStatistics - stats to update
      reason - reason for stream being closed; used in messages
      remaining - remaining bytes
  • Method Details

    • apply

      public Boolean 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:
      apply in interface org.apache.hadoop.util.functional.CallableRaisingIOE<TStream extends InputStream & software.amazon.awssdk.http.Abortable>
      Returns:
      was the stream aborted?
    • getUri

      public String getUri()
    • getSdkStream

      public TStream getSdkStream()
    • shouldAbort

      public boolean shouldAbort()
    • getRemaining

      public int getRemaining()
    • getStreamStatistics

      public S3AInputStreamStatistics getStreamStatistics()
    • getReason

      public String getReason()
    • executed

      public boolean executed()
    • getThrown

      public Exception getThrown()
    • getDrained

      public int getDrained()
    • aborted

      public boolean aborted()
    • toString

      public String toString()
      Overrides:
      toString in class Object