public final class ExecutionList extends Object
A list of listeners, each with an associated
guarantees that every
Runnable that is added will
be executed after
execute() is called. Any
after the call to
execute is still guaranteed to execute. There is no
guarantee, however, that listeners will be executed in the order that they
Exceptions thrown by a listener will be propagated up to the executor.
Any exception thrown during
Executor.execute (e.g., a
RejectedExecutionException or an exception thrown by direct execution) will be caught and
|Constructor and Description|
Creates a new, empty
|Modifier and Type||Method and Description|
Runs this execution list, executing all existing pairs in the order they were added.
Executorto 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.directExecutor(). For heavier
directExecutor() carries some caveats: First, the
thread that the listener runs in depends on whether the
ExecutionList has been executed at the time it is added. In particular,
listeners may run in the thread that calls
add. Second, the thread
execute() may be an internal implementation thread, such
as an RPC network thread, and
directExecutor() listeners may
run in this thread. Finally, during the execution of a
directExecutor listener, all other registered but unexecuted
listeners are prevented from running, even if those listeners are to run
in other executors.
public void execute()
This method is idempotent. Calling it several times in parallel is semantically equivalent to calling it exactly once.
Copyright © 2010-2014. All Rights Reserved.