PipelinedSubpartition extends ResultSubpartition { @Override public PipelinedSubpartitionView createReadView(BufferProvider bufferProvider) { synchronized (buffers) { if (readView != null) { throw new IllegalStateException("Subpartition " + index + " of " + parent.getPartitionId() + " is being or already has been " + "consumed, but pipelined subpartitions can only be consumed once."); } readView = new PipelinedSubpartitionView(this); LOG.debug("Created read view for subpartition {} of partition {}.", index, parent.getPartitionId()); return readView; } } PipelinedSubpartition(int index, ResultPartition parent); @Override boolean add(Buffer buffer); @Override void finish(); @Override void release(); @Override int releaseMemory(); @Override boolean isReleased(); @Override PipelinedSubpartitionView createReadView(BufferProvider bufferProvider); @Override String toString();  }
@Test public void testIllegalReadViewRequest() throws Exception { final PipelinedSubpartition subpartition = createSubpartition(); assertNotNull(subpartition.createReadView(null)); try { subpartition.createReadView(null); fail("Did not throw expected exception after duplicate read view request."); } catch (IllegalStateException expected) { } }