Class InterruptMonitor

java.lang.Object
software.amazon.awssdk.core.internal.http.InterruptMonitor

public final class InterruptMonitor extends Object
A set of utilities for monitoring the status of the currently-executing SDK thread. This is useful for periodically checking whether our thread has been interrupted so that we can abort execution of a request.
  • Method Details

    • checkInterrupted

      public static void checkInterrupted() throws InterruptedException
      Check if the thread has been interrupted. If so throw an InterruptedException. Long running tasks should be periodically checked if the current thread has been interrupted and handle it appropriately
      Throws:
      InterruptedException - If thread has been interrupted
    • checkInterrupted

      public static void checkInterrupted(SdkHttpFullResponse response) throws InterruptedException
      Check if the thread has been interrupted. If so throw an InterruptedException. Long running tasks should be periodically checked if the current thread has been interrupted and handle it appropriately
      Parameters:
      response - Response to be closed before returning control to the caller to avoid leaking the connection.
      Throws:
      InterruptedException - If thread has been interrupted