Class InterruptionChecker


  • public class InterruptionChecker
    extends java.lang.Object
    Check if this thread or any other thread that shares this InterruptionChecker instance has been interrupted or has thrown an exception.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void check()
      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.
      boolean checkAndReturn()  
      java.util.concurrent.ExecutionException executionException​(java.lang.Exception e)
      Stop all threads that share this InterruptionChecker due to an exception being thrown in one of them.
      void interrupt()
      Interrupt all threads that share this InterruptionChecker.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InterruptionChecker

        public InterruptionChecker()
    • Method Detail

      • interrupt

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

        public boolean checkAndReturn()
        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 java.lang.InterruptedException,
                          java.util.concurrent.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:
        java.lang.InterruptedException - If this thread or any other thread that shares this InterruptionChecker instance has been interrupted.
        java.util.concurrent.ExecutionException - If this thread or any other thread that shares this InterruptionChecker instance has thrown an exception.
      • executionException

        public java.util.concurrent.ExecutionException executionException​(java.lang.Exception e)
        Stop all threads that share this InterruptionChecker due to an exception being thrown in one of them.
        Parameters:
        e - The exception that was thrown.
        Returns:
        A new ExecutionException.