Class OffloaderAwareExecutor

    • Method Detail

      • execute

        public Cancellable execute​(java.lang.Runnable task)
                            throws java.util.concurrent.RejectedExecutionException
        Description copied from interface: Executor
        Executes the passed task as soon as possible.
        Specified by:
        execute in interface Executor
        Parameters:
        task - to execute.
        Returns:
        Cancellable to cancel the task if not yet executed.
        Throws:
        java.util.concurrent.RejectedExecutionException - If the task is rejected.
      • schedule

        public Cancellable schedule​(java.lang.Runnable task,
                                    long delay,
                                    java.util.concurrent.TimeUnit unit)
                             throws java.util.concurrent.RejectedExecutionException
        Description copied from interface: Executor
        Executes the passed task after delay amount of units time has passed.

        Note this method is not guaranteed to provide real time execution. For example implementations are free to consolidate tasks into time buckets to reduce the overhead of timer management at the cost of reduced timer fidelity.

        Specified by:
        schedule in interface Executor
        Parameters:
        task - to execute.
        delay - The time duration that is allowed to elapse before task is executed.
        unit - The units for delay.
        Returns:
        Cancellable to cancel the task if not yet executed.
        Throws:
        java.util.concurrent.RejectedExecutionException - If the task is rejected.
      • ensureThreadAffinity

        public static Executor ensureThreadAffinity​(Executor executor)
        If the passed Executor does not honor thread affinity then return a new Executor that does honor thread affinity.
        Parameters:
        executor - Executor to inspect and wrap if required.
        Returns:
        An Executor that honors thread affinity.