Package com.streambase.liveview.client
Class AbstractBatchedQueryListener
java.lang.Object
com.streambase.liveview.client.AbstractQueryListener
com.streambase.liveview.client.AbstractBatchedQueryListener
- All Implemented Interfaces:
QueryListener,EventListener
An abstract implementation of a
QueryListener that batches up multiple events
and sends them to the concrete implementation.
Concrete implementations must implement the abstract snapshot(List, boolean) and update(List) methods
to receive batched up events.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a listener with quarter-second interval and the maximum batch size.AbstractBatchedQueryListener(long interval, TimeUnit unit, boolean collapseEvents) Constructor to set an interval for receiving batched results.AbstractBatchedQueryListener(long interval, TimeUnit unit, boolean collapseEvents, int maxBatchSize) Constructor to set an interval for receiving batched results. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the thread that calls the batch methods periodicallyvoidEvent when an exception occurs during the query.voidfinalize()voidqueryClosed(QueryClosedEvent event) Event when a query being listened to is closed.abstract voidsnapshot(List<TupleAddedEvent> eventList, boolean complete) This batch method is called one or more times for snapshot results.voidsnapshotBegin(BeginSnapshotEvent event) Event to indicate the start of the result snapshot.voidsnapshotEnd(EndSnapshotEvent event) Event to indicate the query snapshot is complete.voidtupleAdded(TupleAddedEvent event) Event when a new tuple is added to the result.voidtupleRemoved(TupleRemovedEvent event) Event when an existing tuple is removed from the result.voidtupleUpdated(TupleUpdatedEvent event) Event when an existing tuple in the result is updated.abstract voidupdate(List<AbstractTupleEvent> eventList) This batch method is called zero or more times for continuous updates.Methods inherited from class com.streambase.liveview.client.AbstractQueryListener
deleteBegin, deleteEndMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.streambase.liveview.client.QueryListener
aggMarkBegin, aggMarkEnd
-
Constructor Details
-
AbstractBatchedQueryListener
public AbstractBatchedQueryListener()Constructs a listener with quarter-second interval and the maximum batch size. -
AbstractBatchedQueryListener
Constructor to set an interval for receiving batched results.- Parameters:
interval- notification intervalunit- notification interval unitcollapseEvents- whether or not to collapsed multiple updates in the same batch
-
AbstractBatchedQueryListener
public AbstractBatchedQueryListener(long interval, TimeUnit unit, boolean collapseEvents, int maxBatchSize) Constructor to set an interval for receiving batched results.- Parameters:
interval- notification intervalunit- notification interval unitcollapseEvents- whether or not to collapsed multiple updates in the same batchmaxBatchSize- max batch size before notification
-
-
Method Details
-
snapshot
This batch method is called one or more times for snapshot results.- Parameters:
eventList- the added tuplescomplete- indicator whether the snapshot is complete or not
-
update
This batch method is called zero or more times for continuous updates.- Parameters:
eventList- the continuous tuple events
-
tupleRemoved
Event when an existing tuple is removed from the result.This method may be extended, ensuring a super call is made.
- Specified by:
tupleRemovedin interfaceQueryListener- Overrides:
tupleRemovedin classAbstractQueryListener- Parameters:
event- remove event
-
tupleAdded
Event when a new tuple is added to the result.This method may be extended, ensuring a super call is made.
- Specified by:
tupleAddedin interfaceQueryListener- Overrides:
tupleAddedin classAbstractQueryListener- Parameters:
event- add event
-
tupleUpdated
Event when an existing tuple in the result is updated.This method may be extended, ensuring a super call is made.
- Specified by:
tupleUpdatedin interfaceQueryListener- Overrides:
tupleUpdatedin classAbstractQueryListener- Parameters:
event- update event
-
snapshotBegin
Event to indicate the start of the result snapshot. This is the first method called when a query starts returning results, but this method is also called to indicate a reset (a complete restart of the query.)This method may be extended, ensuring a super call is made.
- Specified by:
snapshotBeginin interfaceQueryListener- Overrides:
snapshotBeginin classAbstractQueryListener- Parameters:
event- snapshot begin
-
snapshotEnd
Event to indicate the query snapshot is complete.This method may be extended, ensuring a super call is made.
- Specified by:
snapshotEndin interfaceQueryListener- Overrides:
snapshotEndin classAbstractQueryListener- Parameters:
event- snapshot end
-
exceptionRaised
Event when an exception occurs during the query. Since 1.3, reaching the row limit is considered an exception.This method may be extended, ensuring a super call is made.
- Specified by:
exceptionRaisedin interfaceQueryListener- Overrides:
exceptionRaisedin classAbstractQueryListener- Parameters:
event- exception event
-
queryClosed
Event when a query being listened to is closed.This method may be extended, ensuring a super call is made.
- Specified by:
queryClosedin interfaceQueryListener- Overrides:
queryClosedin classAbstractQueryListener- Parameters:
event- query closed event
-
close
public void close()Closes the thread that calls the batch methods periodically -
finalize
-