Class InterruptionChecker

java.lang.Object
nonapi.io.github.classgraph.concurrency.InterruptionChecker

public class InterruptionChecker extends Object
Check if this thread or any other thread that shares this InterruptionChecker instance has been interrupted or has thrown an exception.
  • Field Details

  • Constructor Details

    • InterruptionChecker

      public InterruptionChecker()
  • Method Details

    • interrupt

      public void interrupt()
      Interrupt all threads that share this InterruptionChecker.
    • setExecutionException

      public void setExecutionException(ExecutionException executionException)
      Set the ExecutionException that was thrown by a worker.
      Parameters:
      executionException - the execution exception that was thrown
    • getExecutionException

      public ExecutionException getExecutionException()
      Get the ExecutionException that was thrown by a worker, or null if none.
      Returns:
      the ExecutionException that was thrown by a worker, or null if none.
    • getCause

      public static Throwable getCause(Throwable throwable)
      Get the cause of an ExecutionException.
      Parameters:
      throwable - the Throwable
      Returns:
      the cause
    • checkAndReturn

      public boolean checkAndReturn()
      Check for interruption and return interruption status.
      Returns:
      true if this thread or any other thread that shares this InterruptionChecker instance has been interrupted or has thrown an exception.
    • check

      public void check() throws InterruptedException, ExecutionException
      Check if this thread or any other thread that shares this InterruptionChecker instance has been interrupted or has thrown an exception, and if so, throw InterruptedException.
      Throws:
      InterruptedException - If a thread has been interrupted.
      ExecutionException - if a thread has thrown an uncaught exception.