class PipelinedSubpartition extends ResultSubpartition {

	@Override
	public PipelinedSubpartitionView createReadView(BufferAvailabilityListener availabilityListener) throws IOException {
		synchronized (buffers) {
			checkState(!isReleased);
			checkState(readView == null,
					"Subpartition %s of is being (or already has been) consumed, " +
					"but pipelined subpartitions can only be consumed once.", index, parent.getPartitionId());

			LOG.debug("Creating read view for subpartition {} of partition {}.", index, parent.getPartitionId());

			readView = new PipelinedSubpartitionView(this, availabilityListener);
			if (!buffers.isEmpty()) {
				notifyDataAvailable();
			}
		}

		return readView;
	}

	  PipelinedSubpartition(int index, ResultPartition parent);

}