Package com.yahoo.processing.response
Class DefaultIncomingData<DATATYPE extends Data>
java.lang.Object
com.yahoo.processing.response.DefaultIncomingData<DATATYPE>
- All Implemented Interfaces:
IncomingData<DATATYPE>
public class DefaultIncomingData<DATATYPE extends Data>
extends Object
implements IncomingData<DATATYPE>
The default incoming data implementation
- Author:
- bratseth
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.yahoo.processing.response.IncomingData
IncomingData.NullIncomingData<DATATYPE extends Data> -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance which must be assigned an owner after creationDefaultIncomingData(DataList<DATATYPE> owner) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds new data without completing thisvoidAdds new data without completing thisvoidAdds new data and marks this as completedvoidAdds new data and marks this as completedvoidaddNewDataListener(Runnable listener, Executor executor) Add a listener which will be invoked every time new data is added to this.final voidassignOwner(DataList<DATATYPE> owner) Assigns the owner of this.Returns a future in which all the incoming data that will be produced in this is available.drain()Gets and removes all the data currently available in this.getOwner()Returns the owner (target DataList) of this.booleanReturns whether the data in this is completevoidMarks this as completed and notify any listenerstoString()
-
Constructor Details
-
DefaultIncomingData
public DefaultIncomingData()Creates an instance which must be assigned an owner after creation -
DefaultIncomingData
-
-
Method Details
-
assignOwner
Assigns the owner of this. Throws an exception if the owner is already set. -
getOwner
Description copied from interface:IncomingDataReturns the owner (target DataList) of this. Note that accessing the owner from the thread producing incoming data is generally *not* thread safe.- Specified by:
getOwnerin interfaceIncomingData<DATATYPE extends Data>
-
completedFuture
Description copied from interface:IncomingDataReturns a future in which all the incoming data that will be produced in this is available. Listeners on this are invoked on the thread producing the incoming data (or a thread spawned from it), which in general is separate from the thread using the data list. Hence, listeners on this even cannot in general assume that they may modify the data list or the request.The data is not
drainedinto the owner of this by this method. That must be done by the thread using the data list.This return the list owning this for convenience.
- Specified by:
completedFuturein interfaceIncomingData<DATATYPE extends Data>
-
isComplete
public boolean isComplete()Returns whether the data in this is complete- Specified by:
isCompletein interfaceIncomingData<DATATYPE extends Data>
-
addLast
Adds new data and marks this as completed- Specified by:
addLastin interfaceIncomingData<DATATYPE extends Data>
-
add
Adds new data without completing this- Specified by:
addin interfaceIncomingData<DATATYPE extends Data>
-
addLast
Adds new data and marks this as completed- Specified by:
addLastin interfaceIncomingData<DATATYPE extends Data>
-
add
Adds new data without completing this- Specified by:
addin interfaceIncomingData<DATATYPE extends Data>
-
markComplete
public void markComplete()Marks this as completed and notify any listeners- Specified by:
markCompletein interfaceIncomingData<DATATYPE extends Data>
-
drain
Gets and removes all the data currently available in this. The returned list is a modifiable fresh instance owned by the caller.- Specified by:
drainin interfaceIncomingData<DATATYPE extends Data>
-
addNewDataListener
Description copied from interface:IncomingDataAdd a listener which will be invoked every time new data is added to this. This listener may be invoked at any time in any thread, any thread synchronization is left to the listener itself- Specified by:
addNewDataListenerin interfaceIncomingData<DATATYPE extends Data>
-
toString
-