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
TheCheckpointedInputGate
usesCheckpointBarrierHandler
to handle incomingCheckpointBarrier
from 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, MailboxExecutor mailboxExecutor)
Creates a new checkpoint stream aligner.CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, MailboxExecutor mailboxExecutor, UpstreamRecoveryTracker upstreamRecoveryTracker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allChannelsRecovered()
void
close()
Cleans up all internally held resources.CompletableFuture<Void>
getAllBarriersReceivedFuture(long checkpointId)
CompletableFuture<?>
getAvailableFuture()
InputChannel
getChannel(int channelIndex)
List<InputChannelInfo>
getChannelInfos()
int
getNumberOfInputChannels()
PullingAsyncDataInput.EndOfDataStatus
hasReceivedEndOfData()
Tells if we consumed all available data.boolean
isFinished()
Optional<BufferOrEvent>
pollNext()
Poll the next element.String
toString()
-
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, 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, MailboxExecutor mailboxExecutor, UpstreamRecoveryTracker upstreamRecoveryTracker)
-
-
Method Detail
-
getAvailableFuture
public CompletableFuture<?> getAvailableFuture()
- Specified by:
getAvailableFuture
in 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:PullingAsyncDataInput
Poll the next element. This method should be non blocking.- Specified by:
pollNext
in interfacePullingAsyncDataInput<BufferOrEvent>
- Returns:
Optional.empty()
will be returned if there is no data to return or ifPullingAsyncDataInput.isFinished()
returns true. OtherwiseOptional.of(element)
.- Throws:
IOException
InterruptedException
-
getAllBarriersReceivedFuture
public CompletableFuture<Void> getAllBarriersReceivedFuture(long checkpointId)
-
isFinished
public boolean isFinished()
- Specified by:
isFinished
in 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:PullingAsyncDataInput
Tells 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:
hasReceivedEndOfData
in interfacePullingAsyncDataInput<BufferOrEvent>
-
close
public void close() throws IOException
Cleans up all internally held resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in 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()
-
-