@Internal public class CheckpointedInputGate extends Object implements PullingAsyncDataInput<BufferOrEvent>, Closeable
CheckpointedInputGate
uses CheckpointBarrierHandler
to handle incoming CheckpointBarrier
from the InputGate
.PullingAsyncDataInput.EndOfDataStatus
AvailabilityProvider.AvailabilityHelper
AVAILABLE
Constructor and Description |
---|
CheckpointedInputGate(InputGate inputGate,
CheckpointBarrierHandler barrierHandler,
MailboxExecutor mailboxExecutor)
Creates a new checkpoint stream aligner.
|
CheckpointedInputGate(InputGate inputGate,
CheckpointBarrierHandler barrierHandler,
MailboxExecutor mailboxExecutor,
UpstreamRecoveryTracker upstreamRecoveryTracker) |
Modifier and Type | Method and 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() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
and, isApproximatelyAvailable, isAvailable, or
public CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, MailboxExecutor mailboxExecutor)
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.
inputGate
- The input gate to draw the buffers and events from.barrierHandler
- Handler that controls which channels are blocked.public CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, MailboxExecutor mailboxExecutor, UpstreamRecoveryTracker upstreamRecoveryTracker)
public CompletableFuture<?> getAvailableFuture()
getAvailableFuture
in interface AvailabilityProvider
public Optional<BufferOrEvent> pollNext() throws IOException, InterruptedException
PullingAsyncDataInput
pollNext
in interface PullingAsyncDataInput<BufferOrEvent>
Optional.empty()
will be returned if there is no data to return or if PullingAsyncDataInput.isFinished()
returns true. Otherwise Optional.of(element)
.IOException
InterruptedException
public CompletableFuture<Void> getAllBarriersReceivedFuture(long checkpointId)
public boolean isFinished()
isFinished
in interface PullingAsyncDataInput<BufferOrEvent>
public PullingAsyncDataInput.EndOfDataStatus hasReceivedEndOfData()
PullingAsyncDataInput
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
.
hasReceivedEndOfData
in interface PullingAsyncDataInput<BufferOrEvent>
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- Thrown if the cleanup of I/O resources failed.public int getNumberOfInputChannels()
public InputChannel getChannel(int channelIndex)
public List<InputChannelInfo> getChannelInfos()
public boolean allChannelsRecovered()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.