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 AvailabilityProvider
Interface defining couple of essential methods for listening on data availability using
CompletableFuture. For usage check out for example PullingAsyncDataInput.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA availability implementation for providing the helpful functions of resetting the available/unavailable states. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CompletableFuture<?>Constant that allows to avoid volatile checksCompletableFuture.isDone(). -
Method Summary
Modifier and TypeMethodDescriptionstatic CompletableFuture<?>and(CompletableFuture<?> first, CompletableFuture<?> second) default booleanChecks whether this instance is available only via constantAVAILABLEto avoid performance concern caused by volatile access inCompletableFuture.isDone().default booleanIn 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 Details
-
AVAILABLE
Constant that allows to avoid volatile checksCompletableFuture.isDone(). CheckisAvailable()andisApproximatelyAvailable()for more explanation.
-
-
Method Details
-
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
-
or
-