@GwtIncompatible final class ListenerCallQueue<L> extends java.lang.Object implements java.lang.Runnable
This class is very similar to SerializingExecutor
with the exception that tasks can be
enqueued without necessarily executing immediately.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ListenerCallQueue.Callback<L> |
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.Executor |
executor |
private boolean |
isThreadScheduled |
private L |
listener |
private static java.util.logging.Logger |
logger |
private java.util.Queue<ListenerCallQueue.Callback<L>> |
waitQueue |
Constructor and Description |
---|
ListenerCallQueue(L listener,
java.util.concurrent.Executor executor) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
add(ListenerCallQueue.Callback<L> callback)
Enqueues a task to be run.
|
(package private) void |
execute()
Executes all listeners added prior to this call, serially and in order.
|
void |
run() |
private static final java.util.logging.Logger logger
private final L listener
private final java.util.concurrent.Executor executor
private final java.util.Queue<ListenerCallQueue.Callback<L>> waitQueue
private boolean isThreadScheduled
ListenerCallQueue(L listener, java.util.concurrent.Executor executor)
void add(ListenerCallQueue.Callback<L> callback)
void execute()
public void run()
run
in interface java.lang.Runnable