@Override public boolean nextBufferIsEvent() { synchronized (this) { if (nextBuffer == null) { try { nextBuffer = requestAndFillBuffer(); } catch (Exception e) { // we can ignore this here (we will get it again once getNextBuffer() is called) return false; } } return nextBuffer != null && !nextBuffer.isBuffer(); } }
@Override public boolean nextBufferIsEvent() { synchronized (this) { if (nextBuffer == null) { try { nextBuffer = requestAndFillBuffer(); } catch (Exception e) { // we can ignore this here (we will get it again once getNextBuffer() is called) return false; } } return nextBuffer != null && !nextBuffer.isBuffer(); } }
@Override public boolean nextBufferIsEvent() { synchronized (this) { if (nextBuffer == null) { try { nextBuffer = requestAndFillBuffer(); } catch (Exception e) { // we can ignore this here (we will get it again once getNextBuffer() is called) return false; } } return nextBuffer != null && !nextBuffer.isBuffer(); } }
@Nullable @Override public BufferAndBacklog getNextBuffer() throws IOException, InterruptedException { if (isSpillInProgress) { return null; } Buffer current; boolean nextBufferIsEvent; synchronized (this) { if (nextBuffer == null) { current = requestAndFillBuffer(); } else { current = nextBuffer; } nextBuffer = requestAndFillBuffer(); nextBufferIsEvent = nextBuffer != null && !nextBuffer.isBuffer(); } if (current == null) { return null; } int newBacklog = parent.decreaseBuffersInBacklog(current); return new BufferAndBacklog(current, newBacklog > 0 || nextBufferIsEvent, newBacklog, nextBufferIsEvent); }
@Nullable @Override public BufferAndBacklog getNextBuffer() throws IOException, InterruptedException { if (isSpillInProgress) { return null; } Buffer current; boolean nextBufferIsEvent; synchronized (this) { if (nextBuffer == null) { current = requestAndFillBuffer(); } else { current = nextBuffer; } nextBuffer = requestAndFillBuffer(); nextBufferIsEvent = nextBuffer != null && !nextBuffer.isBuffer(); } if (current == null) { return null; } int newBacklog = parent.decreaseBuffersInBacklog(current); return new BufferAndBacklog(current, newBacklog > 0 || nextBufferIsEvent, newBacklog, nextBufferIsEvent); }
@Nullable @Override public BufferAndBacklog getNextBuffer() throws IOException, InterruptedException { if (isSpillInProgress) { return null; } try { Buffer current; boolean nextBufferIsEvent; synchronized (this) { if (nextBuffer == null) { current = requestAndFillBuffer(); } else { current = nextBuffer; } nextBuffer = requestAndFillBuffer(); nextBufferIsEvent = nextBuffer != null && !nextBuffer.isBuffer(); } if (current == null) { return null; } int newBacklog = parent.decreaseBuffersInBacklog(current); return new BufferAndBacklog(current, newBacklog > 0 || nextBufferIsEvent, newBacklog, nextBufferIsEvent); } catch (Throwable t) { // Mark all data retrieval errors as DataConsumptionException. throw new DataConsumptionException(parent.parent.getPartitionId(), t); } }