Class ExecutorUtil


  • public final class ExecutorUtil
    extends java.lang.Object
    Shuts down a list of Executors. terminate(Executor...) will shut down all specified ExecutorServices immediately and wait for their termination. An Executor which is not an ExecutorService will be ignored silently.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ExecutorUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isShutdown​(java.util.concurrent.Executor executor)
      Returns true if and only if the specified executor is an ExecutorService and is shut down.
      static void shutdownNow​(java.util.concurrent.Executor executor)
      Try to call ExecutorService.shutdownNow()
      static void terminate​(java.lang.ThreadLocal<java.util.concurrent.Executor> deadLockChecker, java.util.concurrent.Executor... executors)
      Shuts down the specified executors using the given ThreadLocal to check if there is a deadlock
      static void terminate​(java.util.concurrent.Executor... executors)
      Shuts down the specified executors.
      • Methods inherited from class java.lang.Object

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

      • ExecutorUtil

        private ExecutorUtil()
    • Method Detail

      • shutdownNow

        public static void shutdownNow​(java.util.concurrent.Executor executor)
        Try to call ExecutorService.shutdownNow()
      • isShutdown

        public static boolean isShutdown​(java.util.concurrent.Executor executor)
        Returns true if and only if the specified executor is an ExecutorService and is shut down. Please note that this method returns false if the specified executor is not an ExecutorService.
      • terminate

        public static void terminate​(java.util.concurrent.Executor... executors)
        Shuts down the specified executors.
      • terminate

        public static void terminate​(java.lang.ThreadLocal<java.util.concurrent.Executor> deadLockChecker,
                                     java.util.concurrent.Executor... executors)
        Shuts down the specified executors using the given ThreadLocal to check if there is a deadlock