@Override public Throwable getFailureCause() { return subpartitionView.getFailureCause(); }
@Override public boolean isReleased() { return subpartitionView.isReleased(); }
@Override void notifySubpartitionConsumed() throws IOException { if (subpartitionView != null) { subpartitionView.notifySubpartitionConsumed(); } }
@Override public void releaseAllResources() throws IOException { subpartitionView.releaseAllResources(); }
Buffer next = subpartitionView.getNextBuffer(); if (subpartitionView.isReleased()) { throw new CancelTaskException("Consumed partition " + subpartitionView + " has been released."); } else { numBytesIn.inc(next.getSize()); return new BufferAndAvailability(next, remaining > 0); } else if (subpartitionView.isReleased()) { throw new ProducerFailedException(subpartitionView.getFailureCause()); } else { throw new IllegalStateException("No buffer available and producer partition not released.");
@Override Optional<BufferAndAvailability> getNextBuffer() throws IOException, InterruptedException { checkError(); ResultSubpartitionView subpartitionView = this.subpartitionView; if (subpartitionView == null) { // There is a possible race condition between writing a EndOfPartitionEvent (1) and flushing (3) the Local // channel on the sender side, and reading EndOfPartitionEvent (2) and processing flush notification (4). When // they happen in that order (1 - 2 - 3 - 4), flush notification can re-enqueue LocalInputChannel after (or // during) it was released during reading the EndOfPartitionEvent (2). if (isReleased) { return Optional.empty(); } // this can happen if the request for the partition was triggered asynchronously // by the time trigger // would be good to avoid that, by guaranteeing that the requestPartition() and // getNextBuffer() always come from the same thread // we could do that by letting the timer insert a special "requesting channel" into the input gate's queue subpartitionView = checkAndWaitForSubpartitionView(); } BufferAndBacklog next = subpartitionView.getNextBuffer(); if (next == null) { if (subpartitionView.isReleased()) { throw new CancelTaskException("Consumed partition " + subpartitionView + " has been released."); } else { return Optional.empty(); } } numBytesIn.inc(next.buffer().getSizeUnsafe()); return Optional.of(new BufferAndAvailability(next.buffer(), next.isMoreAvailable(), next.buffersInBacklog())); }
public BufferAndAvailability getNextBuffer() throws IOException, InterruptedException { Buffer next = subpartitionView.getNextBuffer(); if (next != null) { long remaining = numBuffersAvailable.decrementAndGet(); sequenceNumber++; if (remaining >= 0) { return new BufferAndAvailability(next, remaining > 0); } else { throw new IllegalStateException("no buffer available"); } } else { return null; } }
@Override public boolean isAvailable() { return subpartitionView.isAvailable(); }
@Override public void flush() { synchronized (buffers) { if (readView != null) { readView.notifyDataAvailable(); } } }
/** * Returns true only if the next buffer is an event or the reader has both available * credits and buffers. */ @Override public boolean isAvailable() { // BEWARE: this must be in sync with #isAvailable(BufferAndBacklog)! return hasBuffersAvailable() && (numCreditsAvailable > 0 || subpartitionView.nextBufferIsEvent()); }
@Override public void releaseAllResources() throws IOException { subpartitionView.releaseAllResources(); }
BufferAndBacklog next = subpartitionView.getNextBuffer(); if (subpartitionView.isReleased()) { throw new CancelTaskException("Consumed partition " + subpartitionView + " has been released."); } else {
@Override public BufferAndAvailability getNextBuffer() throws IOException, InterruptedException { BufferAndBacklog next = subpartitionView.getNextBuffer(); if (next != null) { sequenceNumber++; return new BufferAndAvailability(next.buffer(), next.isMoreAvailable(), next.buffersInBacklog()); } else { return null; } }
@Override public boolean isAvailable() { return subpartitionView.isAvailable(); }
@Override public void flush() { synchronized (buffers) { if (readView != null) { readView.notifyDataAvailable(); } } }
/** * Returns true only if the next buffer is an event or the reader has both available * credits and buffers. */ @Override public boolean isAvailable() { // BEWARE: this must be in sync with #isAvailable(BufferAndBacklog)! return hasBuffersAvailable() && (numCreditsAvailable > 0 || subpartitionView.nextBufferIsEvent()); }
@Override public void releaseAllResources() throws IOException { subpartitionView.releaseAllResources(); }
BufferAndBacklog next = subpartitionView.getNextBuffer(); if (subpartitionView.isReleased()) { throw new CancelTaskException("Consumed partition " + subpartitionView + " has been released."); } else {
@Override void notifySubpartitionConsumed() throws IOException { if (subpartitionView != null) { subpartitionView.notifySubpartitionConsumed(); } }
@Override public BufferAndAvailability getNextBuffer() throws IOException, InterruptedException { BufferAndBacklog next = subpartitionView.getNextBuffer(); if (next != null) { sequenceNumber++; return new BufferAndAvailability(next.buffer(), next.isMoreAvailable(), next.buffersInBacklog()); } else { return null; } }