Package nl.vpro.util

Class ThreadPools


  • public final class ThreadPools
    extends Object
    Utilities related to ThreadPools Perhaps this can be deprecated in favour of ForkJoinPool.commonPool()?
    Since:
    1.5
    Author:
    Michiel Meeuwissen
    • Field Detail

      • THREAD_GROUP

        public static final ThreadGroup THREAD_GROUP
      • copyExecutor

        public static final ThreadPoolExecutor copyExecutor
        An executor service used for 'copy' threads. Mainly in Copier, but it can be used for similar processes.

        These may be quite long-lived thread, performing simple jobs like copying streams.

      • longBackgroundExecutor

        public static final ThreadPoolExecutor longBackgroundExecutor
        An executor service used for relatively long-lived background jobs.

        These may be quite long-lived thread, performing more complex jobs like complicated SQL queries.

        Since:
        3.0
      • backgroundExecutor

        public static final ScheduledExecutorService backgroundExecutor
        A scheduled executor service with fixed pool size, so should be used to schedule short-lived background tasks only.
      • startUpExecutor

        public static final ThreadPoolExecutor startUpExecutor
        An executor service used for threads running during bootstrap of the application. Core size is 0, so that after a few minutes (when all is up) all threads will be shut down.
    • Method Detail

      • createThreadFactory

        public static ThreadFactory createThreadFactory​(String namePrefix,
                                                        boolean daemon,
                                                        int priority)
      • createThreadFactory

        public static ThreadFactory createThreadFactory​(ThreadGroup threadGroup,
                                                        String namePrefix,
                                                        boolean daemon,
                                                        int priority)
      • shutdown

        public static void shutdown()