Package com.yahoo.processing.response
Class IncomingData.NullIncomingData<DATATYPE extends Data>
java.lang.Object
com.yahoo.processing.response.IncomingData.NullIncomingData<DATATYPE>
- All Implemented Interfaces:
IncomingData<DATATYPE>
- Enclosing interface:
- IncomingData<DATATYPE extends Data>
public static final class IncomingData.NullIncomingData<DATATYPE extends Data>
extends Object
implements IncomingData<DATATYPE>
Creates a null implementation of this which is empty and complete at creation:
- Provides immediate return without incurring any memory synchronization for any read method.
- Throws an exception on any write method
This allows consumers to check for completion the same way whether or not the data list in question supports asynchronous addition of data, and without incurring unnecessary costs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA future which is always done and incurs no synchronization.Nested classes/interfaces inherited from interface com.yahoo.processing.response.IncomingData
IncomingData.NullIncomingData<DATATYPE extends Data> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd new data without completing thisvoidAdd new data without completing this.voidAdd new data and mark this as completedvoidAdd new data and mark this as completedvoidaddNewDataListener(Runnable listener, Executor executor) Adds a new data listener to this - this is a no-op as new data can never be added to this implementation.Returns a future in which all the incoming data that will be produced in this is available.drain()Get and remove all the data currently available in thisgetOwner()Returns the owner (target DataList) of this.booleanReturns truevoidDo nothing as this is already completetoString()
-
Constructor Details
-
NullIncomingData
-
-
Method Details
-
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>
-
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>
-
isComplete
public boolean isComplete()Returns true- Specified by:
isCompletein interfaceIncomingData<DATATYPE extends Data>
-
addLast
Description copied from interface:IncomingDataAdd new data and mark this as completed- Specified by:
addLastin interfaceIncomingData<DATATYPE extends Data>- Throws:
IllegalStateException- as this is read only
-
add
Description copied from interface:IncomingDataAdd new data without completing this- Specified by:
addin interfaceIncomingData<DATATYPE extends Data>- Throws:
IllegalStateException- as this is read only
-
addLast
Description copied from interface:IncomingDataAdd new data and mark this as completed- Specified by:
addLastin interfaceIncomingData<DATATYPE extends Data>- Throws:
IllegalStateException- as this is read only
-
add
Description copied from interface:IncomingDataAdd new data without completing this.- Specified by:
addin interfaceIncomingData<DATATYPE extends Data>- Throws:
IllegalStateException- as this is read only
-
markComplete
public void markComplete()Do nothing as this is already complete- Specified by:
markCompletein interfaceIncomingData<DATATYPE extends Data>
-
drain
Description copied from interface:IncomingDataGet and remove all the data currently available in this- Specified by:
drainin interfaceIncomingData<DATATYPE extends Data>
-
addNewDataListener
Adds a new data listener to this - this is a no-op as new data can never be added to this implementation.- Specified by:
addNewDataListenerin interfaceIncomingData<DATATYPE extends Data>
-
toString
-