com.streambase.liveview.client

## Class AbstractBatchedQueryListener

- java.lang.Object
- - com.streambase.liveview.client.AbstractQueryListener
  - - com.streambase.liveview.client.AbstractBatchedQueryListener

- All Implemented Interfaces:
    QueryListener, EventListener

      public abstract class AbstractBatchedQueryListener
      extends AbstractQueryListener

  An abstract implementation of a `QueryListener` that batches up multiple events and sends them to the concrete implementation.

  Concrete implementations must implement the abstract `AbstractBatchedQueryListener.snapshot(List, boolean)` and `AbstractBatchedQueryListener.update(List)` methods to receive batched up events.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractBatchedQueryListener()` Constructs 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

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the thread that calls the batch methods periodically
    `void` | `exceptionRaised(QueryExceptionEvent event)` Event when an exception occurs during the query.
    `void` | `finalize()`
    `void` | `queryClosed(QueryClosedEvent event)` Event when a query being listened to is closed.
    `abstract void` | `snapshot(List<TupleAddedEvent> eventList, boolean complete)` This batch method is called one or more times for snapshot results.
    `void` | `snapshotBegin(BeginSnapshotEvent event)` Event to indicate the start of the result snapshot.
    `void` | `snapshotEnd(EndSnapshotEvent event)` Event to indicate the query snapshot is complete.
    `void` | `tupleAdded(TupleAddedEvent event)` Event when a new tuple is added to the result.
    `void` | `tupleRemoved(TupleRemovedEvent event)` Event when an existing tuple is removed from the result.
    `void` | `tupleUpdated(TupleUpdatedEvent event)` Event when an existing tuple in the result is updated.
    `abstract void` | `update(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, deleteEnd`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.streambase.liveview.client.QueryListener

      `aggMarkBegin, aggMarkEnd`

- - ### Constructor Detail

    - #### AbstractBatchedQueryListener

          public AbstractBatchedQueryListener()

      Constructs a listener with quarter-second interval and the maximum batch size.

    - #### AbstractBatchedQueryListener

          public AbstractBatchedQueryListener(long interval,
                                              TimeUnit unit,
                                              boolean collapseEvents)

      Constructor to set an interval for receiving batched results.
      Parameters:
        `interval` - notification interval
        `unit` - notification interval unit
        `collapseEvents` - 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 interval
        `unit` - notification interval unit
        `collapseEvents` - whether or not to collapsed multiple updates in the same batch
        `maxBatchSize` - max batch size before notification

  - ### Method Detail

    - #### snapshot

          public abstract void snapshot(List<TupleAddedEvent> eventList,
                                        boolean complete)

      This batch method is called one or more times for snapshot results.
      Parameters:
        `eventList` - the added tuples
        `complete` - indicator whether the snapshot is complete or not

    - #### update

          public abstract void update(List<AbstractTupleEvent> eventList)

      This batch method is called zero or more times for continuous updates.
      Parameters:
        `eventList` - the continuous tuple events

    - #### tupleRemoved

          public void tupleRemoved(TupleRemovedEvent event)

      Event when an existing tuple is removed from the result.

      This method may be extended, ensuring a super call is made.

      Specified by:
        `tupleRemoved` in interface `QueryListener`
      Overrides:
        `tupleRemoved` in class `AbstractQueryListener`
      Parameters:
        `event` - remove event

    - #### tupleAdded

          public void tupleAdded(TupleAddedEvent event)

      Event when a new tuple is added to the result.

      This method may be extended, ensuring a super call is made.

      Specified by:
        `tupleAdded` in interface `QueryListener`
      Overrides:
        `tupleAdded` in class `AbstractQueryListener`
      Parameters:
        `event` - add event

    - #### tupleUpdated

          public void tupleUpdated(TupleUpdatedEvent event)

      Event when an existing tuple in the result is updated.

      This method may be extended, ensuring a super call is made.

      Specified by:
        `tupleUpdated` in interface `QueryListener`
      Overrides:
        `tupleUpdated` in class `AbstractQueryListener`
      Parameters:
        `event` - update event

    - #### snapshotBegin

          public void snapshotBegin(BeginSnapshotEvent event)

      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:
        `snapshotBegin` in interface `QueryListener`
      Overrides:
        `snapshotBegin` in class `AbstractQueryListener`
      Parameters:
        `event` - snapshot begin

    - #### snapshotEnd

          public void snapshotEnd(EndSnapshotEvent event)

      Event to indicate the query snapshot is complete.

      This method may be extended, ensuring a super call is made.

      Specified by:
        `snapshotEnd` in interface `QueryListener`
      Overrides:
        `snapshotEnd` in class `AbstractQueryListener`
      Parameters:
        `event` - snapshot end

    - #### exceptionRaised

          public void exceptionRaised(QueryExceptionEvent event)

      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:
        `exceptionRaised` in interface `QueryListener`
      Overrides:
        `exceptionRaised` in class `AbstractQueryListener`
      Parameters:
        `event` - exception event

    - #### queryClosed

          public void queryClosed(QueryClosedEvent event)

      Event when a query being listened to is closed.

      This method may be extended, ensuring a super call is made.

      Specified by:
        `queryClosed` in interface `QueryListener`
      Overrides:
        `queryClosed` in class `AbstractQueryListener`
      Parameters:
        `event` - query closed event

    - #### close

          public void close()

      Closes the thread that calls the batch methods periodically

    - #### finalize

          public void finalize()

      Overrides:
        `finalize` in class `Object`

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.