public interface EPListenable
Modifier and Type | Method and Description |
---|---|
void |
addListener(UpdateListener listener)
Add a listener that observes events.
|
void |
addListenerWithReplay(UpdateListener listener)
Add an update listener replaying current statement results to the listener.
|
Iterator<UpdateListener> |
getUpdateListeners()
Returns an iterator of update listeners.
|
void |
removeAllListeners()
Remove all listeners.
|
void |
removeListener(UpdateListener listener)
Remove a listener that observes events.
|
void addListener(UpdateListener listener)
listener
- to addIllegalStateException
- when attempting to add a listener to a destroyed statementvoid removeListener(UpdateListener listener)
listener
- to removevoid removeAllListeners()
Iterator<UpdateListener> getUpdateListeners()
The returned iterator does not allow the remove operation.
void addListenerWithReplay(UpdateListener listener)
The listener receives current statement results as the first call to the update method of the listener, passing in the newEvents parameter the current statement results as an array of zero or more events. Subsequent calls to the update method of the listener are statement results.
Current statement results are the events returned by the iterator or safeIterator methods.
Delivery of current statement results in the first call is performed by the same thread invoking this method, while subsequent calls to the listener may deliver statement results by the same or other threads.
Note: this is a blocking call, delivery is atomic: Events occurring during iteration and delivery to the listener are guaranteed to be delivered in a separate call and not lost. The listener implementation should minimize long-running or blocking operations.
Delivery is only atomic relative to the current statement. If the same listener instance is registered with other statements it may receive other statement result s simultaneously.
If a statement is not started an therefore does not have current results, the listener receives a single invocation with a null value in newEvents.
listener
- to addCopyright © 2005–2018. All rights reserved.