/** * Finishes the result partition. * * <p>After this operation, it is not possible to add further data to the result partition. * * <p>For BLOCKING results, this will trigger the deployment of consuming tasks. */ public void finish() throws IOException { boolean success = false; try { checkInProduceState(); for (ResultSubpartition subpartition : subpartitions) { subpartition.finish(); } success = true; } finally { if (success) { isFinished = true; notifyPipelinedConsumers(); } } }
/** * Finishes the result partition. * * <p>After this operation, it is not possible to add further data to the result partition. * * <p>For BLOCKING results, this will trigger the deployment of consuming tasks. */ public void finish() throws IOException { boolean success = false; try { checkInProduceState(); for (ResultSubpartition subpartition : subpartitions) { subpartition.finish(); } success = true; } finally { if (success) { isFinished = true; notifyPipelinedConsumers(); } } }
/** * Finishes the result partition. * * <p> After this operation, it is not possible to add further data to the result partition. * * <p> For BLOCKING results, this will trigger the deployment of consuming tasks. */ public void finish() throws IOException { boolean success = false; try { checkInProduceState(); for (ResultSubpartition subpartition : subpartitions) { synchronized (subpartition) { subpartition.finish(); } } success = true; } finally { if (success) { isFinished = true; notifyPipelinedConsumers(); } } }
@Override public void addBufferConsumer(BufferConsumer bufferConsumer, int subpartitionIndex) throws IOException { checkNotNull(bufferConsumer); ResultSubpartition subpartition; try { checkInProduceState(); subpartition = subpartitions[subpartitionIndex]; } catch (Exception ex) { bufferConsumer.close(); throw ex; } if (subpartition.add(bufferConsumer)) { notifyPipelinedConsumers(); } }
@Override public void addBufferConsumer(BufferConsumer bufferConsumer, int subpartitionIndex) throws IOException { checkNotNull(bufferConsumer); ResultSubpartition subpartition; try { checkInProduceState(); subpartition = subpartitions[subpartitionIndex]; } catch (Exception ex) { bufferConsumer.close(); throw ex; } if (subpartition.add(bufferConsumer)) { notifyPipelinedConsumers(); } }
/** * Adds a buffer to the subpartition with the given index. * * <p> For PIPELINED results, this will trigger the deployment of consuming tasks after the * first buffer has been added. */ public void add(Buffer buffer, int subpartitionIndex) throws IOException { boolean success = false; try { checkInProduceState(); final ResultSubpartition subpartition = subpartitions[subpartitionIndex]; synchronized (subpartition) { success = subpartition.add(buffer); // Update statistics totalNumberOfBuffers++; totalNumberOfBytes += buffer.getSize(); } } finally { if (success) { notifyPipelinedConsumers(); } else { buffer.recycle(); } } }