Class ListenerCallQueue.PerListenerQueue<L>
- java.lang.Object
-
- com.google.common.util.concurrent.ListenerCallQueue.PerListenerQueue<L>
-
- All Implemented Interfaces:
java.lang.Runnable
- Enclosing class:
- ListenerCallQueue<L>
private static final class ListenerCallQueue.PerListenerQueue<L> extends java.lang.Object implements java.lang.Runnable
A special purpose queue/executor that dispatches listener events serially on a configured executor. Each event can be added and dispatched as separate phases.This class is very similar to
SequentialExecutor
with the exception that events can be added without necessarily executing immediately.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.concurrent.Executor
executor
(package private) boolean
isThreadScheduled
(package private) java.util.Queue<java.lang.Object>
labelQueue
(package private) L
listener
(package private) java.util.Queue<ListenerCallQueue.Event<L>>
waitQueue
-
Constructor Summary
Constructors Constructor Description PerListenerQueue(L listener, java.util.concurrent.Executor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
add(ListenerCallQueue.Event<L> event, java.lang.Object label)
Enqueues a event to be run.(package private) void
dispatch()
Dispatches all listeners enqueued prior to this call, serially and in order.void
run()
-
-
-
Field Detail
-
listener
final L listener
-
executor
final java.util.concurrent.Executor executor
-
waitQueue
final java.util.Queue<ListenerCallQueue.Event<L>> waitQueue
-
labelQueue
final java.util.Queue<java.lang.Object> labelQueue
-
isThreadScheduled
boolean isThreadScheduled
-
-
Constructor Detail
-
PerListenerQueue
PerListenerQueue(L listener, java.util.concurrent.Executor executor)
-
-
Method Detail
-
add
void add(ListenerCallQueue.Event<L> event, java.lang.Object label)
Enqueues a event to be run.
-
dispatch
void dispatch()
Dispatches all listeners enqueued prior to this call, serially and in order.
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
-