Class EventLoopsScheduler

    • Field Detail

      • KEY_MAX_THREADS

        static final java.lang.String KEY_MAX_THREADS
        Key to setting the maximum number of computation scheduler threads. Zero or less is interpreted as use available. Capped by available.
        See Also:
        Constant Field Values
      • MAX_THREADS

        static final int MAX_THREADS
        The maximum number of computation scheduler threads.
      • threadFactory

        final java.util.concurrent.ThreadFactory threadFactory
    • Constructor Detail

      • EventLoopsScheduler

        public EventLoopsScheduler​(java.util.concurrent.ThreadFactory threadFactory)
        Create a scheduler with pool size equal to the available processor count and using least-recent worker selection policy.
        Parameters:
        threadFactory - the factory to use with the executors
    • Method Detail

      • start

        public void start()
        Description copied from interface: SchedulerLifecycle
        Allows the Scheduler instance to start threads and accept tasks on them.

        Implementations should make sure the call is idempotent and threadsafe.

        Specified by:
        start in interface SchedulerLifecycle
      • shutdown

        public void shutdown()
        Description copied from interface: SchedulerLifecycle
        Instructs the Scheduler instance to stop threads and stop accepting tasks on any outstanding Workers.

        Implementations should make sure the call is idempotent and threadsafe.

        Specified by:
        shutdown in interface SchedulerLifecycle
      • scheduleDirect

        public Subscription scheduleDirect​(Action0 action)
        Schedules the action directly on one of the event loop workers without the additional infrastructure and checking.
        Parameters:
        action - the action to schedule
        Returns:
        the subscription