类 ThreadlessExecutor

  • 所有已实现的接口:
    Executor, ExecutorService

    public class ThreadlessExecutor
    extends AbstractExecutorService
    The most important difference between this Executor and other normal Executor is that this one doesn't manage any thread.

    Tasks submitted to this executor through execute(Runnable) will not get scheduled to a specific thread, though normal executors always do the schedule. Those tasks are stored in a blocking queue and will only be executed when a thread calls waitAndDrain(), the thread executing the task is exactly the same as the one calling waitAndDrain.

    • 构造器详细资料

      • ThreadlessExecutor

        public ThreadlessExecutor​(ExecutorService sharedExecutor)
    • 方法详细资料

      • setWaitingFuture

        public void setWaitingFuture​(CompletableFuture<?> waitingFuture)
      • isWaiting

        public boolean isWaiting()
      • waitAndDrain

        public void waitAndDrain()
                          throws InterruptedException
        Waits until there is a task, executes the task and all queued tasks (if there're any). The task is either a normal response or a timeout response.
        抛出:
        InterruptedException
      • execute

        public void execute​(Runnable runnable)
        If the calling thread is still waiting for a callback task, add the task into the blocking queue to wait for schedule. Otherwise, submit to shared callback executor directly.
        参数:
        runnable -
      • notifyReturn

        public void notifyReturn​(Throwable t)
        tells the thread blocking on waitAndDrain() to return, despite of the current status, to avoid endless waiting.
      • shutdown

        public void shutdown()
        The following methods are still not supported
      • isShutdown

        public boolean isShutdown()
      • isTerminated

        public boolean isTerminated()