@Internal public class BarrierTracker extends Object implements CheckpointBarrierHandler
Unlike the BarrierBuffer, the BarrierTracker does not block the input
channels that have sent barriers, so it cannot be used to gain "exactly-once" processing
guarantees. It can, however, be used to gain "at least once" processing guarantees.
NOTE: This implementation strictly assumes that newer checkpoints have higher checkpoint IDs.
| Constructor and Description |
|---|
BarrierTracker(org.apache.flink.runtime.io.network.partition.consumer.InputGate inputGate) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup()
Cleans up all internally held resources.
|
org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent |
getNextNonBlocked()
Returns the next
BufferOrEvent that the operator may consume. |
boolean |
isEmpty()
Checks if the barrier handler has buffered any data internally.
|
void |
registerCheckpointEventHandler(org.apache.flink.runtime.util.event.EventListener<org.apache.flink.runtime.io.network.api.CheckpointBarrier> checkpointHandler)
Registers the given event handler to be notified on successful checkpoints.
|
public BarrierTracker(org.apache.flink.runtime.io.network.partition.consumer.InputGate inputGate)
public org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent getNextNonBlocked()
throws IOException,
InterruptedException
CheckpointBarrierHandlerBufferOrEvent that the operator may consume.
This call blocks until the next BufferOrEvent is available, or until the stream
has been determined to be finished.getNextNonBlocked in interface CheckpointBarrierHandlernull, if the stream is finished.IOException - Thrown if the network or local disk I/O fails.InterruptedException - Thrown if the thread is interrupted while blocking during
waiting for the next BufferOrEvent to become available.public void registerCheckpointEventHandler(org.apache.flink.runtime.util.event.EventListener<org.apache.flink.runtime.io.network.api.CheckpointBarrier> checkpointHandler)
CheckpointBarrierHandlerregisterCheckpointEventHandler in interface CheckpointBarrierHandlercheckpointHandler - The handler to register.public void cleanup()
CheckpointBarrierHandlercleanup in interface CheckpointBarrierHandlerpublic boolean isEmpty()
CheckpointBarrierHandlerisEmpty in interface CheckpointBarrierHandlerTrue, if no data is buffered internally, false otherwise.Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.