Class BoundedBlockingSubpartitionDirectTransferReader
- java.lang.Object
-
- org.apache.flink.runtime.io.network.partition.BoundedBlockingSubpartitionDirectTransferReader
-
- All Implemented Interfaces:
ResultSubpartitionView
public class BoundedBlockingSubpartitionDirectTransferReader extends Object implements ResultSubpartitionView
The reader (read view) of a BoundedBlockingSubpartition based onFileRegion
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.network.partition.ResultSubpartitionView
ResultSubpartitionView.AvailabilityWithBacklog
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acknowledgeAllDataProcessed()
ResultSubpartitionView.AvailabilityWithBacklog
getAvailabilityAndBacklog(boolean isCreditAvailable)
Get the availability and backlog of the view.Throwable
getFailureCause()
ResultSubpartitionView
can decide whether the failure cause should be reported to consumer as failure (primary failure) orProducerFailedException
(secondary failure).ResultSubpartition.BufferAndBacklog
getNextBuffer()
Returns the nextBuffer
instance of this queue iterator.int
getNumberOfQueuedBuffers()
boolean
isReleased()
void
notifyDataAvailable()
void
notifyNewBufferSize(int newBufferSize)
int
peekNextBufferSubpartitionId()
Returns the index of the subpartition where the next buffer locates, or -1 if there is no buffer available and the subpartition to be consumed is not determined.void
releaseAllResources()
void
resumeConsumption()
String
toString()
int
unsynchronizedGetNumberOfQueuedBuffers()
-
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.network.partition.ResultSubpartitionView
notifyPriorityEvent, notifyRequiredSegmentId
-
-
-
-
Method Detail
-
getNextBuffer
@Nullable public ResultSubpartition.BufferAndBacklog getNextBuffer() throws IOException
Description copied from interface:ResultSubpartitionView
Returns the nextBuffer
instance of this queue iterator.If there is currently no instance available, it will return
null
. This might happen for example when a pipelined queue producer is slower than the consumer or a spilled queue needs to read in more data.Important: The consumer has to make sure that each buffer instance will eventually be recycled with
Buffer.recycleBuffer()
after it has been consumed.- Specified by:
getNextBuffer
in interfaceResultSubpartitionView
- Throws:
IOException
-
getAvailabilityAndBacklog
public ResultSubpartitionView.AvailabilityWithBacklog getAvailabilityAndBacklog(boolean isCreditAvailable)
Description copied from interface:ResultSubpartitionView
Get the availability and backlog of the view. The availability represents if the view is ready to get buffer from it. The backlog represents the number of available data buffers.- Specified by:
getAvailabilityAndBacklog
in interfaceResultSubpartitionView
- Parameters:
isCreditAvailable
- the availability of credits for thisResultSubpartitionView
.- Returns:
- availability and backlog.
-
releaseAllResources
public void releaseAllResources() throws IOException
- Specified by:
releaseAllResources
in interfaceResultSubpartitionView
- Throws:
IOException
-
isReleased
public boolean isReleased()
- Specified by:
isReleased
in interfaceResultSubpartitionView
-
getFailureCause
public Throwable getFailureCause()
Description copied from interface:ResultSubpartitionView
ResultSubpartitionView
can decide whether the failure cause should be reported to consumer as failure (primary failure) orProducerFailedException
(secondary failure). Secondary failure can be reported only if producer (upstream task) is guaranteed to failover.BEWARE: Incorrectly reporting failure cause as primary failure, can hide the root cause of the failure from the user.
- Specified by:
getFailureCause
in interfaceResultSubpartitionView
-
unsynchronizedGetNumberOfQueuedBuffers
public int unsynchronizedGetNumberOfQueuedBuffers()
- Specified by:
unsynchronizedGetNumberOfQueuedBuffers
in interfaceResultSubpartitionView
-
getNumberOfQueuedBuffers
public int getNumberOfQueuedBuffers()
- Specified by:
getNumberOfQueuedBuffers
in interfaceResultSubpartitionView
-
notifyNewBufferSize
public void notifyNewBufferSize(int newBufferSize)
- Specified by:
notifyNewBufferSize
in interfaceResultSubpartitionView
-
peekNextBufferSubpartitionId
public int peekNextBufferSubpartitionId()
Description copied from interface:ResultSubpartitionView
Returns the index of the subpartition where the next buffer locates, or -1 if there is no buffer available and the subpartition to be consumed is not determined.- Specified by:
peekNextBufferSubpartitionId
in interfaceResultSubpartitionView
-
notifyDataAvailable
public void notifyDataAvailable()
- Specified by:
notifyDataAvailable
in interfaceResultSubpartitionView
-
resumeConsumption
public void resumeConsumption()
- Specified by:
resumeConsumption
in interfaceResultSubpartitionView
-
acknowledgeAllDataProcessed
public void acknowledgeAllDataProcessed()
- Specified by:
acknowledgeAllDataProcessed
in interfaceResultSubpartitionView
-
-