- Enclosing interface:
- DemandAware
public static interface DemandAware.Sink
A demand-aware
DemandAware.Sink that accepts data. It can signal its DemandAware.Source demand/readiness to emit more data.
Instances of implementing classes are required to be thread-safe as they are shared amongst multiple threads.-
Method Summary
Modifier and Type Method Description booleanhasDemand()voidremoveSource()Removes theDemandAware.Sourcereference from thisDemandAware.Sink.voidsetSource(DemandAware.Source source)Sets theDemandAware.Sourcefor aDemandAware.Sink.
-
Method Details
-
hasDemand
boolean hasDemand()Returnstrueif theDemandAware.Sinkhas demand orfalseif the source has no demand.falsemeans either theDemandAware.Sinkhas no demand in general because data is not needed or the current demand is saturated.- Returns:
trueif theDemandAware.Sinkdemands data.
-
setSource
Sets theDemandAware.Sourcefor aDemandAware.Sink. TheDemandAware.Sinkis notified by thisDemandAware.Sourceif the source indicates new demand or the sink catches up so it's ready to receive more data.- Parameters:
source- the reference to the dataDemandAware.Source, must not benull.
-
removeSource
void removeSource()Removes theDemandAware.Sourcereference from thisDemandAware.Sink. Any previously setDemandAware.Sourcewill no longer be asked for data.
-