Class ArrayDataList<DATATYPE extends Data>

java.lang.Object
com.yahoo.component.provider.FreezableClass
com.yahoo.component.provider.ListenableFreezableClass
com.yahoo.processing.response.AbstractDataList<DATATYPE>
com.yahoo.processing.response.ArrayDataList<DATATYPE>
All Implemented Interfaces:
com.yahoo.component.provider.Freezable, com.yahoo.component.provider.ListenableFreezable, Data, DataList<DATATYPE>, Ordered, Streamed
Direct Known Subclasses:
ProcessorLibrary.UnorderedArrayDataList

public class ArrayDataList<DATATYPE extends Data> extends AbstractDataList<DATATYPE>
A data list backed by an array. This implementation supports subclassing.
Author:
bratseth
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.yahoo.processing.response.AbstractDataList

    AbstractDataList.DrainOnGetFuture<DATATYPE extends Data>
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a simple data list which does not allow late incoming data
    protected
    ArrayDataList(Request request, IncomingData<DATATYPE> incomingData)
    Creates a simple data list which receives incoming data in the given instance
    protected
    ArrayDataList(Request request, IncomingData<DATATYPE> incomingData, boolean ordered, boolean streamed)
    Creates a simple data list which receives incoming data in the given instance
  • Method Summary

    Modifier and Type
    Method
    Description
    add(DATATYPE data)
    Adds a child data item to this.
    void
    Adds a listener which is invoked every time data is added to this list.
    Returns a reference to the list backing this.
    static <DATATYPE extends Data>
    ArrayDataList<DATATYPE>
    create(Request request)
    Creates a simple data list which does not allow late incoming data
    static <DATATYPE extends Data>
    ArrayDataList<DATATYPE>
    Creates an instance of this which supports incoming data through the default mechanism (DefaultIncomingData)
    static <DATATYPE extends Data>
    ArrayDataList<DATATYPE>
    Creates an instance of this which supports incoming data through the default mechanism (DefaultIncomingData) and where this data cannot be returned to clients until this is completed.
    static <DATATYPE extends Data>
    ArrayDataList<DATATYPE>
    Creates an instance of this which supports incoming data through the default mechanism (DefaultIncomingData), and where this data can be rendered in any order.
    void
    Irreversibly prevent further changes to the items of this.
    get(int index)
    Returns the data element at index

    Methods inherited from class com.yahoo.processing.response.AbstractDataList

    complete, completeFuture, incoming, isOrdered, isStreamed, request, toString

    Methods inherited from class com.yahoo.component.provider.ListenableFreezableClass

    addFreezeListener, clone

    Methods inherited from class com.yahoo.component.provider.FreezableClass

    ensureNotFrozen, isFrozen

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.yahoo.processing.response.DataList

    close

    Methods inherited from interface com.yahoo.component.provider.Freezable

    isFrozen

    Methods inherited from interface com.yahoo.component.provider.ListenableFreezable

    addFreezeListener
  • Constructor Details

    • ArrayDataList

      protected ArrayDataList(Request request)
      Creates a simple data list which does not allow late incoming data
      Parameters:
      request - the request which created this data list
    • ArrayDataList

      protected ArrayDataList(Request request, IncomingData<DATATYPE> incomingData)
      Creates a simple data list which receives incoming data in the given instance
      Parameters:
      request - the request which created this data list, never null
      incomingData - the recipient of incoming data to this list, never null
    • ArrayDataList

      protected ArrayDataList(Request request, IncomingData<DATATYPE> incomingData, boolean ordered, boolean streamed)
      Creates a simple data list which receives incoming data in the given instance
      Parameters:
      request - the request which created this data list, never null
      incomingData - the recipient of incoming data to this list, never null
  • Method Details

    • create

      public static <DATATYPE extends Data> ArrayDataList<DATATYPE> create(Request request)
      Creates a simple data list which does not allow late incoming data
      Parameters:
      request - the request which created this data list
    • createAsync

      public static <DATATYPE extends Data> ArrayDataList<DATATYPE> createAsync(Request request)
      Creates an instance of this which supports incoming data through the default mechanism (DefaultIncomingData)
    • createAsyncUnordered

      public static <DATATYPE extends Data> ArrayDataList<DATATYPE> createAsyncUnordered(Request request)
      Creates an instance of this which supports incoming data through the default mechanism (DefaultIncomingData), and where this data can be rendered in any order.
    • createAsyncNonstreamed

      public static <DATATYPE extends Data> ArrayDataList<DATATYPE> createAsyncNonstreamed(Request request)
      Creates an instance of this which supports incoming data through the default mechanism (DefaultIncomingData) and where this data cannot be returned to clients until this is completed.
    • add

      public DATATYPE add(DATATYPE data)
      Description copied from interface: DataList
      Adds a child data item to this.
      Parameters:
      data - the data to add to this
      Returns:
      the input data instance, for chaining
    • get

      public DATATYPE get(int index)
      Returns the data element at index
    • asList

      public List<DATATYPE> asList()
      Returns a reference to the list backing this. The list may be modified freely, unless this is frozen. If frozen, the only permissible write operations are those that add new items to the end of the list.
    • addDataListener

      public void addDataListener(Runnable runnable)
      Description copied from interface: DataList
      Adds a listener which is invoked every time data is added to this list. The listener is always invoked on the same thread which is adding the data, and hence it can modify this list freely without synchronization.
    • freeze

      public void freeze()
      Irreversibly prevent further changes to the items of this. This allows the processing engine to start streaming the current content of this list back to the client (if applicable).

      Adding new items to the end of this list is permitted even after freeze. If frozen, those items may be streamed back to the client immediately on add.

      Calling this on a frozen list has no effect.

      Specified by:
      freeze in interface com.yahoo.component.provider.Freezable
      Overrides:
      freeze in class com.yahoo.component.provider.ListenableFreezableClass