|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.util.concurrent.ExecutionList
public final class ExecutionList
A list of listeners, each with an associated Executor
, that
guarantees that every Runnable
that is added will
be executed after execute()
is called. Any Runnable
added
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
are added.
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 inline execution) will be caught and
logged.
Constructor Summary | |
---|---|
ExecutionList()
Creates a new, empty ExecutionList . |
Method Summary | |
---|---|
void |
add(Runnable runnable,
Executor executor)
Adds the Runnable and accompanying Executor to the list of
listeners to execute. |
void |
execute()
Runs this execution list, executing all existing pairs in the order they were added. |
void |
run()
Deprecated. Use execute() . This method will be removed in Guava
release 11. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExecutionList()
ExecutionList
.
Method Detail |
---|
public void add(Runnable runnable, Executor executor)
Runnable
and accompanying Executor
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 the Future
is
done at the time it is added. In particular, if added late, listeners will
run in the thread that called add
. Second, listeners may run in an
internal thread of the system responsible for the input Future
,
such as an RPC network thread. Finally, during the execution of a sameThreadExecutor
listener, all other
registered but unexecuted listeners are prevented from running, even if
those listeners are to run in other executors.
@Beta @Deprecated public void run()
execute()
. This method will be removed in Guava
release 11.
execute()
.
public void execute()
This method is idempotent. Calling it several times in parallel is semantically equivalent to calling it exactly once.
run
)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |