public interface ResultPartitionWriter extends AutoCloseable, AvailabilityProvider
If AutoCloseable.close() is called before fail(Throwable) or
finish(), it abruptly triggers failure and cancellation of production.
In this case fail(Throwable) still needs to be called afterwards to fully release
all resources associated the the partition and propagate failure cause to the consumer if possible.
AvailabilityProvider.AvailabilityHelperAVAILABLE| Modifier and Type | Method and Description |
|---|---|
boolean |
addBufferConsumer(BufferConsumer bufferConsumer,
int subpartitionIndex)
Adds the bufferConsumer to the subpartition with the given index.
|
void |
fail(Throwable throwable)
Fail the production of the partition.
|
void |
finish()
Successfully finish the production of the partition.
|
void |
flush(int subpartitionIndex)
Manually trigger consumption from enqueued
BufferConsumers in one specified subpartition. |
void |
flushAll()
Manually trigger consumption from enqueued
BufferConsumers in all subpartitions. |
BufferBuilder |
getBufferBuilder()
Requests a
BufferBuilder from this partition for writing data. |
int |
getNumberOfSubpartitions() |
int |
getNumTargetKeyGroups() |
ResultPartitionID |
getPartitionId() |
void |
setup()
Setup partition, potentially heavy-weight, blocking operation comparing to just creation.
|
closegetAvailableFuture, isApproximatelyAvailable, isAvailablevoid setup()
throws IOException
IOExceptionResultPartitionID getPartitionId()
int getNumberOfSubpartitions()
int getNumTargetKeyGroups()
BufferBuilder getBufferBuilder() throws IOException, InterruptedException
BufferBuilder from this partition for writing data.IOExceptionInterruptedExceptionboolean addBufferConsumer(BufferConsumer bufferConsumer, int subpartitionIndex) throws IOException
This method takes the ownership of the passed bufferConsumer and thus is responsible for releasing
it's resources.
To avoid problems with data re-ordering, before adding new BufferConsumer the previously added one
the given subpartitionIndex must be marked as BufferConsumer.isFinished().
IOExceptionvoid flushAll()
BufferConsumers in all subpartitions.void flush(int subpartitionIndex)
BufferConsumers in one specified subpartition.void fail(@Nullable Throwable throwable)
This method propagates non-null failure causes to consumers on a best-effort basis. This call also
leads to the release of all resources associated with the partition. Closing of the partition is still needed
afterwards if it has not been done before.
throwable - failure causevoid finish()
throws IOException
Closing of partition is still needed afterwards.
IOExceptionCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.