@Override public void notifyDataAvailable() { availabilityListener.notifyDataAvailable(); }
@Override public void notifyBuffersAvailable(long numBuffers) throws IOException { availabilityListener.notifyBuffersAvailable(numBuffers); }
@Override public void notifyDataAvailable() { availabilityListener.notifyDataAvailable(); }
/** * This is the call back method for the spill writer. If a spill is still * in progress when this view is created we wait until this method is called * before we notify the availability listener. */ @Override public void onNotification() { isSpillInProgress = false; availabilityListener.notifyBuffersAvailable(numberOfSpilledBuffers); LOG.debug("Finished spilling. Notified about {} available buffers.", numberOfSpilledBuffers); }
@Override public void notifyDataAvailable() { availabilityListener.notifyDataAvailable(); }
@Override public Buffer getNextBuffer() throws IOException, InterruptedException { synchronized (buffers) { if (isReleased.get()) { return null; } else if (nextBuffer != null) { Buffer current = nextBuffer; nextBuffer = buffers.poll(); if (nextBuffer != null) { listener.notifyBuffersAvailable(1); } return current; } } // else: spilled SpilledSubpartitionView spilled = spilledView; if (spilled != null) { return spilled.getNextBuffer(); } else { throw new IllegalStateException("No in-memory buffers available, but also nothing spilled."); } }
/** * This is the call back method for the spill writer. If a spill is still * in progress when this view is created we wait until this method is called * before we notify the availability listener. */ @Override public void onNotification() { isSpillInProgress = false; availabilityListener.notifyDataAvailable(); LOG.debug("Finished spilling. Notified about {} available buffers.", numberOfSpilledBuffers); }
SpillableSubpartitionView( SpillableSubpartition parent, ArrayDeque<Buffer> buffers, IOManager ioManager, int memorySegmentSize, BufferAvailabilityListener listener) { this.parent = checkNotNull(parent); this.buffers = checkNotNull(buffers); this.ioManager = checkNotNull(ioManager); this.memorySegmentSize = memorySegmentSize; this.listener = checkNotNull(listener); synchronized (buffers) { numBuffers = buffers.size(); nextBuffer = buffers.poll(); } if (nextBuffer != null) { listener.notifyBuffersAvailable(1); } }
/** * This is the call back method for the spill writer. If a spill is still * in progress when this view is created we wait until this method is called * before we notify the availability listener. */ @Override public void onNotification() { isSpillInProgress = false; availabilityListener.notifyDataAvailable(); LOG.debug("Finished spilling. Notified about {} available buffers.", numberOfSpilledBuffers); }
SpilledSubpartitionView( ResultSubpartition parent, int memorySegmentSize, BufferFileWriter spillWriter, long numberOfSpilledBuffers, BufferAvailabilityListener availabilityListener) throws IOException { this.parent = checkNotNull(parent); this.bufferPool = new SpillReadBufferPool(2, memorySegmentSize); this.spillWriter = checkNotNull(spillWriter); this.fileReader = new SynchronousBufferFileReader(spillWriter.getChannelID(), false); checkArgument(numberOfSpilledBuffers >= 0); this.numberOfSpilledBuffers = numberOfSpilledBuffers; this.availabilityListener = checkNotNull(availabilityListener); // Check whether async spilling is still in progress. If not, this returns // false and we can notify our availability listener about all available buffers. // Otherwise, we notify only when the spill writer callback happens. if (!spillWriter.registerAllRequestsProcessedListener(this)) { isSpillInProgress = false; availabilityListener.notifyBuffersAvailable(numberOfSpilledBuffers); LOG.debug("No spilling in progress. Notified about {} available buffers.", numberOfSpilledBuffers); } else { LOG.debug("Spilling in progress. Waiting with notification about {} available buffers.", numberOfSpilledBuffers); } }
/** * This is the call back method for the spill writer. If a spill is still * in progress when this view is created we wait until this method is called * before we notify the availability listener. */ @Override public void onNotification() { isSpillInProgress = false; availabilityListener.notifyDataAvailable(); LOG.debug("Finished spilling. Notified about {} available buffers.", numberOfSpilledBuffers); }
SpillableSubpartitionView( SpillableSubpartition parent, ArrayDeque<BufferConsumer> buffers, IOManager ioManager, int memorySegmentSize, BufferAvailabilityListener listener) { this.parent = checkNotNull(parent); this.buffers = checkNotNull(buffers); this.ioManager = checkNotNull(ioManager); this.memorySegmentSize = memorySegmentSize; this.listener = checkNotNull(listener); synchronized (buffers) { numBuffers = buffers.size(); nextBuffer = buffers.poll(); } if (nextBuffer != null) { listener.notifyDataAvailable(); } }
SpillableSubpartitionView( SpillableSubpartition parent, ArrayDeque<BufferConsumer> buffers, IOManager ioManager, int memorySegmentSize, BufferAvailabilityListener listener) { this.parent = checkNotNull(parent); this.buffers = checkNotNull(buffers); this.ioManager = checkNotNull(ioManager); this.memorySegmentSize = memorySegmentSize; this.listener = checkNotNull(listener); synchronized (buffers) { numBuffers = buffers.size(); nextBuffer = buffers.poll(); } if (nextBuffer != null) { listener.notifyDataAvailable(); } }
private void enqueueBuffer(Buffer buffer) throws IOException { synchronized (lock) { if (isReleased) { buffer.recycleBuffer(); return; } buffers.add(buffer); if (buffer.isBuffer()) { --currentCredit; totalReadLength += buffer.getSize(); } // If EOF is enqueued directly, the condition will fail and there will be no second EOF enqueued. if (totalReadLength == totalLength && totalLength != 0) { buffers.add(EventSerializer.toBuffer(EndOfPartitionEvent.INSTANCE)); } } listener.notifyDataAvailable(); }
SpillableSubpartitionView( SpillableSubpartition parent, ArrayDeque<BufferConsumer> buffers, IOManager ioManager, int memorySegmentSize, BufferAvailabilityListener listener) { this.parent = checkNotNull(parent); this.buffers = checkNotNull(buffers); this.ioManager = checkNotNull(ioManager); this.memorySegmentSize = memorySegmentSize; this.listener = checkNotNull(listener); synchronized (buffers) { numBuffers = buffers.size(); nextBuffer = buffers.poll(); } if (nextBuffer != null) { listener.notifyDataAvailable(); } }
SpilledSubpartitionView( SpillableSubpartition parent, int memorySegmentSize, BufferFileWriter spillWriter, long numberOfSpilledBuffers, BufferAvailabilityListener availabilityListener) throws IOException { this.parent = checkNotNull(parent); this.bufferPool = new SpillReadBufferPool(2, memorySegmentSize); this.spillWriter = checkNotNull(spillWriter); this.fileReader = new SynchronousBufferFileReader(spillWriter.getChannelID(), false); checkArgument(numberOfSpilledBuffers >= 0); this.numberOfSpilledBuffers = numberOfSpilledBuffers; this.availabilityListener = checkNotNull(availabilityListener); // Check whether async spilling is still in progress. If not, this returns // false and we can notify our availability listener about all available buffers. // Otherwise, we notify only when the spill writer callback happens. if (!spillWriter.registerAllRequestsProcessedListener(this)) { isSpillInProgress = false; availabilityListener.notifyDataAvailable(); LOG.debug("No spilling in progress. Notified about {} available buffers.", numberOfSpilledBuffers); } else { LOG.debug("Spilling in progress. Waiting with notification about {} available buffers.", numberOfSpilledBuffers); } }
SpilledSubpartitionView( SpillableSubpartition parent, int memorySegmentSize, BufferFileWriter spillWriter, long numberOfSpilledBuffers, BufferAvailabilityListener availabilityListener) throws IOException { this.parent = checkNotNull(parent); this.bufferPool = new FixedLengthBufferPool(2, memorySegmentSize, MemoryType.HEAP); this.spillWriter = checkNotNull(spillWriter); this.fileReader = new SynchronousBufferFileReader(spillWriter.getChannelID(), false); checkArgument(numberOfSpilledBuffers >= 0); this.numberOfSpilledBuffers = numberOfSpilledBuffers; this.availabilityListener = checkNotNull(availabilityListener); // Check whether async spilling is still in progress. If not, this returns // false and we can notify our availability listener about all available buffers. // Otherwise, we notify only when the spill writer callback happens. if (!spillWriter.registerAllRequestsProcessedListener(this)) { isSpillInProgress = false; availabilityListener.notifyDataAvailable(); LOG.debug("No spilling in progress. Notified about {} available buffers.", numberOfSpilledBuffers); } else { LOG.debug("Spilling in progress. Waiting with notification about {} available buffers.", numberOfSpilledBuffers); } }
SpilledSubpartitionView( SpillableSubpartition parent, int memorySegmentSize, BufferFileWriter spillWriter, long numberOfSpilledBuffers, BufferAvailabilityListener availabilityListener) throws IOException { this.parent = checkNotNull(parent); this.bufferPool = new SpillReadBufferPool(2, memorySegmentSize); this.spillWriter = checkNotNull(spillWriter); this.fileReader = new SynchronousBufferFileReader(spillWriter.getChannelID(), false); checkArgument(numberOfSpilledBuffers >= 0); this.numberOfSpilledBuffers = numberOfSpilledBuffers; this.availabilityListener = checkNotNull(availabilityListener); // Check whether async spilling is still in progress. If not, this returns // false and we can notify our availability listener about all available buffers. // Otherwise, we notify only when the spill writer callback happens. if (!spillWriter.registerAllRequestsProcessedListener(this)) { isSpillInProgress = false; availabilityListener.notifyDataAvailable(); LOG.debug("No spilling in progress. Notified about {} available buffers.", numberOfSpilledBuffers); } else { LOG.debug("Spilling in progress. Waiting with notification about {} available buffers.", numberOfSpilledBuffers); } }
listener.notifyDataAvailable(); } finally { synchronized (lock) {