public abstract class ResultSubpartition extends Object
ResultPartition
instance.Modifier and Type | Class and Description |
---|---|
static class |
ResultSubpartition.BufferAndBacklog
A combination of a
Buffer and the backlog length indicating
how many non-event buffers are available in the subpartition. |
Modifier and Type | Field and Description |
---|---|
protected ArrayDeque<BufferConsumer> |
buffers
All buffers of this subpartition.
|
protected int |
index
The index of the subpartition at the parent partition.
|
protected ResultPartition |
parent
The parent partition this subpartition belongs to.
|
Constructor and Description |
---|
ResultSubpartition(int index,
ResultPartition parent) |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
add(BufferConsumer bufferConsumer)
Adds the given buffer.
|
abstract ResultSubpartitionView |
createReadView(BufferAvailabilityListener availabilityListener) |
int |
decreaseBuffersInBacklog(Buffer buffer)
Decreases the number of non-event buffers by one after fetching a non-event
buffer from this subpartition (for access by the subpartition views).
|
protected int |
decreaseBuffersInBacklogUnsafe(boolean isBuffer) |
abstract void |
finish() |
abstract void |
flush() |
int |
getBuffersInBacklog()
Gets the number of non-event buffers in this subpartition.
|
protected Throwable |
getFailureCause() |
protected long |
getTotalNumberOfBuffers() |
protected long |
getTotalNumberOfBytes() |
protected void |
increaseBuffersInBacklog(BufferConsumer buffer)
Increases the number of non-event buffers by one after adding a non-event
buffer into this subpartition.
|
abstract boolean |
isReleased() |
protected void |
onConsumedSubpartition()
Notifies the parent partition about a consumed
ResultSubpartitionView . |
abstract void |
release() |
abstract int |
unsynchronizedGetNumberOfQueuedBuffers()
Makes a best effort to get the current size of the queue.
|
protected void |
updateStatistics(Buffer buffer) |
protected void |
updateStatistics(BufferConsumer buffer) |
protected final int index
protected final ResultPartition parent
protected final ArrayDeque<BufferConsumer> buffers
public ResultSubpartition(int index, ResultPartition parent)
protected void updateStatistics(BufferConsumer buffer)
protected void updateStatistics(Buffer buffer)
protected long getTotalNumberOfBuffers()
protected long getTotalNumberOfBytes()
protected void onConsumedSubpartition()
ResultSubpartitionView
.protected Throwable getFailureCause()
public abstract boolean add(BufferConsumer bufferConsumer) throws IOException
The request may be executed synchronously, or asynchronously, depending on the implementation.
IMPORTANT: Before adding new BufferConsumer
previously added must be in finished
state. Because of the performance reasons, this is only enforced during the data reading.
bufferConsumer
- the buffer to add (transferring ownership to this writer)IOException
- thrown in case of errors while adding the bufferpublic abstract void flush()
public abstract void finish() throws IOException
IOException
public abstract void release() throws IOException
IOException
public abstract ResultSubpartitionView createReadView(BufferAvailabilityListener availabilityListener) throws IOException
IOException
public abstract boolean isReleased()
@VisibleForTesting public int getBuffersInBacklog()
Beware: This method should only be used in tests in non-concurrent access scenarios since it does not make any concurrency guarantees.
public abstract int unsynchronizedGetNumberOfQueuedBuffers()
public int decreaseBuffersInBacklog(Buffer buffer)
protected int decreaseBuffersInBacklogUnsafe(boolean isBuffer)
protected void increaseBuffersInBacklog(BufferConsumer buffer)
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.