public static final class IncomingData.NullIncomingData<DATATYPE extends Data> extends Object implements IncomingData<DATATYPE>
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.
Modifier and Type | Class and Description |
---|---|
static class |
IncomingData.NullIncomingData.ImmediateFuture<DATATYPE extends Data>
A future which is always done and incurs no synchronization.
|
IncomingData.NullIncomingData<DATATYPE extends Data>
Modifier and Type | Field and Description |
---|---|
private IncomingData.NullIncomingData.ImmediateFuture<DATATYPE> |
completionFuture |
private DataList<DATATYPE> |
owner |
Constructor and Description |
---|
NullIncomingData(DataList<DATATYPE> owner) |
Modifier and Type | Method and Description |
---|---|
void |
add(DATATYPE data)
Add new data without completing this
|
void |
add(List<DATATYPE> data)
Add new data without completing this.
|
void |
addLast(DATATYPE data)
Add new data and mark this as completed
|
void |
addLast(List<DATATYPE> data)
Add new data and mark this as completed
|
void |
addNewDataListener(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.
|
com.google.common.util.concurrent.ListenableFuture<DataList<DATATYPE>> |
completed()
Returns a future in which all the incoming data that will be produced in this is available.
|
List<DATATYPE> |
drain()
Get and remove all the data currently available in this
|
DataList<DATATYPE> |
getOwner()
Returns the owner (target DataList) of this.
|
boolean |
isComplete()
Returns true
|
void |
markComplete()
Do nothing as this is already complete
|
String |
toString() |
private final IncomingData.NullIncomingData.ImmediateFuture<DATATYPE extends Data> completionFuture
public com.google.common.util.concurrent.ListenableFuture<DataList<DATATYPE>> completed()
IncomingData
The data is not drained
into 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.
completed
in interface IncomingData<DATATYPE extends Data>
public DataList<DATATYPE> getOwner()
IncomingData
getOwner
in interface IncomingData<DATATYPE extends Data>
public boolean isComplete()
isComplete
in interface IncomingData<DATATYPE extends Data>
public void addLast(DATATYPE data)
IncomingData
addLast
in interface IncomingData<DATATYPE extends Data>
IllegalStateException
- as this is read onlypublic void add(DATATYPE data)
IncomingData
add
in interface IncomingData<DATATYPE extends Data>
IllegalStateException
- as this is read onlypublic void addLast(List<DATATYPE> data)
IncomingData
addLast
in interface IncomingData<DATATYPE extends Data>
IllegalStateException
- as this is read onlypublic void add(List<DATATYPE> data)
IncomingData
add
in interface IncomingData<DATATYPE extends Data>
IllegalStateException
- as this is read onlypublic void markComplete()
markComplete
in interface IncomingData<DATATYPE extends Data>
public List<DATATYPE> drain()
IncomingData
drain
in interface IncomingData<DATATYPE extends Data>
public void addNewDataListener(Runnable listener, Executor executor)
addNewDataListener
in interface IncomingData<DATATYPE extends Data>
Copyright © 2018. All rights reserved.