// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.processing.response; import java.util.List; import java.util.concurrent.CompletableFuture; /** * A list of data items created due to a processing request. * This list is itself a data item, allowing data items to be organized into a composite tree. *
* A data list can be frozen even though its child data items are not. * When a datalist is frozen the only permissible write operation is to add new items * to the end of the list. *
* Content in a frozen list may be returned to the requesting client immediately by the underlying engine,
* even if the Response owning the list is not returned yet.
*
* @author bratseth
*/
public interface DataList
* Some list instances do not support late incoming data,
* such lists responds to read calls to IncomingData as expected and without
* incurring any synchronization, and throws an exception on write calls.
*/
IncomingData
* Note that if no thread calls completed().get(), this future will never occur.
*
* Any data list consumer who wishes to make sure it sees the complete data for this list
* must call
* Making this call on a list which does not support future data always returns immediately and
* causes no memory synchronization cost.
*/
CompletableFuture
*
* dataList.complete().get()
before consuming this list.
* If a guaranteed non-blocking call to this method is desired, register a listener on the future where all
* data is available for draining (that is, on dataList.incoming().completed()
)
* and resume by calling this method from the listener.
*