Class CheckpointedInputGate
- java.lang.Object
-
- org.apache.flink.streaming.runtime.io.checkpointing.CheckpointedInputGate
-
- All Implemented Interfaces:
Closeable,AutoCloseable,AvailabilityProvider,PullingAsyncDataInput<BufferOrEvent>
@Internal public class CheckpointedInputGate extends Object implements PullingAsyncDataInput<BufferOrEvent>, Closeable
TheCheckpointedInputGateusesCheckpointBarrierHandlerto handle incomingCheckpointBarrierfrom theInputGate.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AvailabilityProvider.AvailabilityHelper
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.PullingAsyncDataInput
PullingAsyncDataInput.EndOfDataStatus
-
-
Field Summary
-
Fields inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AVAILABLE
-
-
Constructor Summary
Constructors Constructor Description CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor)Creates a new checkpoint stream aligner.CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor, UpstreamRecoveryTracker upstreamRecoveryTracker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallChannelsRecovered()voidclose()Cleans up all internally held resources.CompletableFuture<Void>getAllBarriersReceivedFuture(long checkpointId)CompletableFuture<?>getAvailableFuture()InputChannelgetChannel(int channelIndex)List<InputChannelInfo>getChannelInfos()intgetNumberOfInputChannels()PullingAsyncDataInput.EndOfDataStatushasReceivedEndOfData()Tells if we consumed all available data.booleanisFinished()Optional<BufferOrEvent>pollNext()Poll the next element.voidresumeGateConsumption()StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
isApproximatelyAvailable, isAvailable
-
-
-
-
Constructor Detail
-
CheckpointedInputGate
public CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor)
Creates a new checkpoint stream aligner.The aligner will allow only alignments that buffer up to the given number of bytes. When that number is exceeded, it will stop the alignment and notify the task that the checkpoint has been cancelled.
- Parameters:
inputGate- The input gate to draw the buffers and events from.barrierHandler- Handler that controls which channels are blocked.
-
CheckpointedInputGate
public CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor, UpstreamRecoveryTracker upstreamRecoveryTracker)
-
-
Method Detail
-
getAvailableFuture
public CompletableFuture<?> getAvailableFuture()
- Specified by:
getAvailableFuturein interfaceAvailabilityProvider- Returns:
- a future that is completed if the respective provider is available.
-
pollNext
public Optional<BufferOrEvent> pollNext() throws IOException, InterruptedException
Description copied from interface:PullingAsyncDataInputPoll the next element. This method should be non blocking.- Specified by:
pollNextin interfacePullingAsyncDataInput<BufferOrEvent>- Returns:
Optional.empty()will be returned if there is no data to return or ifPullingAsyncDataInput.isFinished()returns true. OtherwiseOptional.of(element).- Throws:
IOExceptionInterruptedException
-
getAllBarriersReceivedFuture
public CompletableFuture<Void> getAllBarriersReceivedFuture(long checkpointId)
-
isFinished
public boolean isFinished()
- Specified by:
isFinishedin interfacePullingAsyncDataInput<BufferOrEvent>- Returns:
- true if is finished and for example end of input was reached, false otherwise.
-
hasReceivedEndOfData
public PullingAsyncDataInput.EndOfDataStatus hasReceivedEndOfData()
Description copied from interface:PullingAsyncDataInputTells if we consumed all available data.Moreover it tells us the reason why there is no more data incoming. If any of the upstream subtasks finished because of the stop-with-savepoint --no-drain, we should not drain the input. See also
StopMode.- Specified by:
hasReceivedEndOfDatain interfacePullingAsyncDataInput<BufferOrEvent>
-
resumeGateConsumption
public void resumeGateConsumption() throws IOException- Throws:
IOException
-
close
public void close() throws IOExceptionCleans up all internally held resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- Thrown if the cleanup of I/O resources failed.
-
getNumberOfInputChannels
public int getNumberOfInputChannels()
- Returns:
- number of underlying input channels.
-
getChannel
public InputChannel getChannel(int channelIndex)
-
getChannelInfos
public List<InputChannelInfo> getChannelInfos()
-
allChannelsRecovered
public boolean allChannelsRecovered()
-
-