Class ExecutorUtils


  • public class ExecutorUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Thread createShutdownHook​(java.io.Closeable closeable)  
      static java.util.concurrent.ThreadFactory newThreadFactory​(java.lang.Class<?> clazz, boolean daemon)  
      static java.util.concurrent.ThreadFactory newThreadFactory​(java.lang.Class<?> clazz, java.lang.String suffix, boolean daemon)  
      static java.util.concurrent.ThreadFactory newThreadFactory​(java.lang.String format, boolean daemon)
      Returns a new thread factory that uses the given pattern to set the thread name.
      static void removeShutdownHook​(java.lang.Thread shutdownHook)  
      static boolean shutdown​(java.util.concurrent.ExecutorService service, long timeout, java.util.concurrent.TimeUnit unit, boolean forceTermination)  
      • Methods inherited from class java.lang.Object

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

      • createShutdownHook

        public static java.lang.Thread createShutdownHook​(java.io.Closeable closeable)
      • newThreadFactory

        public static java.util.concurrent.ThreadFactory newThreadFactory​(java.lang.Class<?> clazz,
                                                                          boolean daemon)
      • newThreadFactory

        public static java.util.concurrent.ThreadFactory newThreadFactory​(java.lang.Class<?> clazz,
                                                                          java.lang.String suffix,
                                                                          boolean daemon)
      • newThreadFactory

        public static java.util.concurrent.ThreadFactory newThreadFactory​(java.lang.String format,
                                                                          boolean daemon)
        Returns a new thread factory that uses the given pattern to set the thread name.
        Parameters:
        format - thread name pattern, where %d can be used to specify the thread number.
        daemon - true for daemon threads
        Returns:
        thread factory that uses the given pattern to set the thread name
      • removeShutdownHook

        public static void removeShutdownHook​(java.lang.Thread shutdownHook)
      • shutdown

        public static boolean shutdown​(java.util.concurrent.ExecutorService service,
                                       long timeout,
                                       java.util.concurrent.TimeUnit unit,
                                       boolean forceTermination)