- Type Parameters:
T
- the class containing the data fields for individual events
- All Implemented Interfaces:
Runnable
, Consumer<T>
public class EventQueue<T extends Event>
extends Object
implements Consumer<T>, Runnable
Decouple event producers from consumers so that event production isn't affected by event consumption
-
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
EventQueue
public EventQueue()
-
Method Details
-
addListener
public void addListener(
Consumer<T> listener)
-
accept
Adds an element to the tail of the queue
- Specified by:
accept
in interface Consumer<T extends Event>
-
-
run
public void run()
- Specified by:
run
in interface Runnable