类 ExecutionList
- java.lang.Object
-
- com.alibaba.dubbo.common.concurrent.ExecutionList
-
public final class ExecutionList extends Object
A list of listeners, each with an associated
Executor
, that guarantees that everyRunnable
that is added will be executed afterexecute()
is called. AnyRunnable
added after the call toexecute
is still guaranteed to execute. There is no guarantee, however, that listeners will be executed in the order that they are added.Exceptions thrown by a listener will be propagated up to the executor. Any exception thrown during
Executor.execute
(e.g., aRejectedExecutionException
or an exception thrown by inline execution) will be caught and logged.
-
-
构造器概要
构造器 构造器 说明 ExecutionList()
Creates a new, emptyExecutionList
.
-
-
-
构造器详细资料
-
ExecutionList
public ExecutionList()
Creates a new, emptyExecutionList
.
-
-
方法详细资料
-
add
public void add(Runnable runnable, Executor executor)
Adds theRunnable
and accompanyingExecutor
to the list of listeners to execute. If execution has already begun, the listener is executed immediately.Note: For fast, lightweight listeners that would be safe to execute in any thread, consider
MoreExecutors#sameThreadExecutor
. For heavier listeners,sameThreadExecutor()
carries some caveats: First, the thread that the listener runs in depends on whether theExecutionList
has been executed at the time it is added. In particular, listeners may run in the thread that callsadd
. Second, the thread that callsexecute()
may be an internal implementation thread, such as an RPC network thread, andsameThreadExecutor()
listeners may run in this thread. Finally, during the execution of asameThreadExecutor
listener, all other registered but unexecuted listeners are prevented from running, even if those listeners are to run in other executors.
-
execute
public void execute()
Runs this execution list, executing all existing pairs in the order they were added. However, note that listeners added after this point may be executed before those previously added, and note that the execution order of all listeners is ultimately chosen by the implementations of the supplied executors.This method is idempotent. Calling it several times in parallel is semantically equivalent to calling it exactly once.
- 从以下版本开始:
- 10.0 (present in 1.0 as
run
)
-
-