Class ThreadlessExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
org.apache.dubbo.common.threadpool.ThreadlessExecutor
- All Implemented Interfaces:
AutoCloseable,Executor,ExecutorService
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
, the thread executing the task
is exactly the same as the one calling waitAndDrain.invalid reference
#waitAndDrain()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long timeout, TimeUnit unit) voidIf the calling thread is still waiting for a callback task, add the task into the blocking queue to wait for schedule.booleanbooleanvoidshutdown()The following methods are still not supportedvoidwaitAndDrain(long deadline) Waits until there is a task, executes the task and all queued tasks (if there're any).Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submitMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.ExecutorService
close
-
Constructor Details
-
ThreadlessExecutor
public ThreadlessExecutor()
-
-
Method Details
-
waitAndDrain
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.- Throws:
InterruptedException
-
execute
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.- Parameters:
runnable-
-
shutdown
public void shutdown()The following methods are still not supported -
shutdownNow
-
isShutdown
public boolean isShutdown() -
isTerminated
public boolean isTerminated() -
awaitTermination
-