Class AndroidExecutionService

    • Constructor Detail

      • AndroidExecutionService

        public AndroidExecutionService()
      • AndroidExecutionService

        public AndroidExecutionService​(@NonNull
                                       ThreadPoolExecutor executor)
    • Method Detail

      • getDefaultExecutor

        @NonNull
        public Executor getDefaultExecutor()
        Description copied from interface: ExecutionService
        Get the main executor. It is guaranteed to be a single thread. Suitable for any task that doesn't take a long time to complete.
        Returns:
        the main executor.
      • postDelayedOnExecutor

        @NonNull
        public ExecutionService.Cancellable postDelayedOnExecutor​(long delayMs,
                                                                  @NonNull
                                                                  Executor executor,
                                                                  @NonNull
                                                                  Runnable task)
        This runs a task on Android's main thread for just long enough to enough to enqueue the passed task on the passed executor. It occupies space in the main looper's message queue but takes no significant time processing, there. If the target executor refuses the task, it is just dropped on the floor.
        Parameters:
        delayMs - delay before posting the task. There may be additional queue delays in the executor.
        executor - an executor on which to execute the task.
        task - the task to be executed.
        Returns:
        a cancellable task