Class PromiseFactory.DefaultExecutors

  • All Implemented Interfaces:
    java.lang.Runnable, java.util.concurrent.RejectedExecutionHandler, java.util.concurrent.ThreadFactory
    Enclosing class:
    PromiseFactory

    private static final class PromiseFactory.DefaultExecutors
    extends java.lang.Object
    implements java.util.concurrent.ThreadFactory, java.util.concurrent.RejectedExecutionHandler, java.lang.Runnable
    Default executors for Promises.
    • Field Detail

      • callbackExecutor

        private static final java.util.concurrent.ThreadPoolExecutor callbackExecutor
      • shutdownHookInstalled

        private final java.util.concurrent.atomic.AtomicBoolean shutdownHookInstalled
      • delegateThreadFactory

        private final java.util.concurrent.ThreadFactory delegateThreadFactory
    • Constructor Detail

      • DefaultExecutors

        private DefaultExecutors()
    • Method Detail

      • callbackExecutor

        static java.util.concurrent.Executor callbackExecutor()
      • scheduledExecutor

        static java.util.concurrent.ScheduledExecutorService scheduledExecutor()
      • newThread

        public java.lang.Thread newThread​(java.lang.Runnable r)
        Executor threads should not prevent VM from exiting
        Specified by:
        newThread in interface java.util.concurrent.ThreadFactory
      • rejectedExecution

        public void rejectedExecution​(java.lang.Runnable callback,
                                      java.util.concurrent.ThreadPoolExecutor executor)
        Call the callback using the caller's thread because the thread pool rejected the execution.
        Specified by:
        rejectedExecution in interface java.util.concurrent.RejectedExecutionHandler
      • run

        public void run()
        Shutdown hook
        Specified by:
        run in interface java.lang.Runnable