Package org.apache.flink.runtime.io
Interface AvailabilityProvider
-
- All Known Subinterfaces:
BufferPool,BufferProvider,PullingAsyncDataInput<T>,PushingAsyncDataInput<T>,RecordWriterDelegate<T>,RecoverableStreamTaskInput<T>,ResultPartitionWriter,StreamInputProcessor,StreamTaskInput<T>
- All Known Implementing Classes:
AbstractStreamTaskNetworkInput,AvailabilityProvider.AvailabilityHelper,BoundedBlockingResultPartition,BroadcastRecordWriter,BufferWritingResultPartition,ChannelSelectorRecordWriter,CheckpointedInputGate,IndexedInputGate,InputGate,InputGateWithMetrics,LocalBufferPool,MultiInputSortingDataInput,MultipleRecordWriters,NetworkBufferPool,NonRecordWriter,PipelinedResultPartition,RecordWriter,RescalingStreamTaskNetworkInput,ResultPartition,SingleInputGate,SingleRecordWriter,SortingDataInput,SortMergeResultPartition,SourceOperator,StreamMultipleInputProcessor,StreamOneInputProcessor,StreamTaskExternallyInducedSourceInput,StreamTaskFinishedOnRestoreSourceInput,StreamTaskNetworkInput,StreamTaskSourceInput,TieredResultPartition,UnionInputGate
@Internal public interface AvailabilityProviderInterface defining couple of essential methods for listening on data availability usingCompletableFuture. For usage check out for examplePullingAsyncDataInput.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classAvailabilityProvider.AvailabilityHelperA availability implementation for providing the helpful functions of resetting the available/unavailable states.
-
Field Summary
Fields Modifier and Type Field Description static CompletableFuture<?>AVAILABLEConstant that allows to avoid volatile checksCompletableFuture.isDone().
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static CompletableFuture<?>and(CompletableFuture<?> first, CompletableFuture<?> second)CompletableFuture<?>getAvailableFuture()default booleanisApproximatelyAvailable()Checks whether this instance is available only via constantAVAILABLEto avoid performance concern caused by volatile access inCompletableFuture.isDone().default booleanisAvailable()In order to best-effort avoid volatile access inCompletableFuture.isDone(), we check the condition offuture == AVAILABLEfirstly for getting probable performance benefits while hot looping.static CompletableFuture<?>or(CompletableFuture<?> first, CompletableFuture<?> second)
-
-
-
Field Detail
-
AVAILABLE
static final CompletableFuture<?> AVAILABLE
Constant that allows to avoid volatile checksCompletableFuture.isDone(). CheckisAvailable()andisApproximatelyAvailable()for more explanation.
-
-
Method Detail
-
getAvailableFuture
CompletableFuture<?> getAvailableFuture()
- Returns:
- a future that is completed if the respective provider is available.
-
isAvailable
default boolean isAvailable()
In order to best-effort avoid volatile access inCompletableFuture.isDone(), we check the condition offuture == AVAILABLEfirstly for getting probable performance benefits while hot looping.It is always safe to use this method in performance nonsensitive scenarios to get the precise state.
- Returns:
- true if this instance is available for further processing.
-
isApproximatelyAvailable
default boolean isApproximatelyAvailable()
Checks whether this instance is available only via constantAVAILABLEto avoid performance concern caused by volatile access inCompletableFuture.isDone(). So it is mainly used in the performance sensitive scenarios which do not always need the precise state.This method is still safe to get the precise state if
getAvailableFuture()was touched via (.get(), .wait(), .isDone(), ...) before, which also has a "happen-before" relationship with this call.- Returns:
- true if this instance is available for further processing.
-
and
static CompletableFuture<?> and(CompletableFuture<?> first, CompletableFuture<?> second)
-
or
static CompletableFuture<?> or(CompletableFuture<?> first, CompletableFuture<?> second)
-
-