Class EventQueue<T>
java.lang.Object
nl.colorize.util.EventQueue<T>
- Type Parameters:
T- The type of event that can be subscribed to.
- All Implemented Interfaces:
Flow.Subscriber<T>
Subscribes to asynchronous events and accumulates all received events and
errors in queue, so that they can be processed at a later time.
Instances of this class are thread-safe: Events can be received and processed on different threads.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears this event queue, without processing the events and errors that are currently in it.voidFlushes the event queue, invoking the specified callback functions for all events and errors that have been received since the last time the event queue was flushed.voidvoidvoidvoidonSubscribe(Flow.Subscription newSubscription) static <T> EventQueue<T> Factory method that creates anEventQueueand immediately subscribes it to the specifiedSubject.
-
Constructor Details
-
EventQueue
public EventQueue()
-
-
Method Details
-
onSubscribe
- Specified by:
onSubscribein interfaceFlow.Subscriber<T>
-
onNext
- Specified by:
onNextin interfaceFlow.Subscriber<T>
-
onError
- Specified by:
onErrorin interfaceFlow.Subscriber<T>
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceFlow.Subscriber<T>
-
flush
-
clear
public void clear()Clears this event queue, without processing the events and errors that are currently in it. -
subscribe
Factory method that creates anEventQueueand immediately subscribes it to the specifiedSubject.
-