/** * Gets the next memory segment that has been filled with data by the reader. This method blocks until * such a segment is available, or until an error occurs in the reader, or the reader is closed. * <p> * WARNING: If this method is invoked without any segment ever returning (for example, because the * {@link #readBlock(MemorySegment)} method has not been invoked appropriately), the method may block * forever. * * @return The next memory segment from the reader's return queue. * @throws IOException Thrown, if an I/O error occurs in the reader while waiting for the request to return. */ @Override public MemorySegment getNextReturnedBlock() throws IOException { try { while (true) { final MemorySegment next = this.returnSegments.poll(1000, TimeUnit.MILLISECONDS); if (next != null) { return next; } else { if (this.closed) { throw new IOException("The reader has been asynchronously closed."); } checkErroneous(); } } } catch (InterruptedException iex) { throw new IOException("Reader was interrupted while waiting for the next returning segment."); } }
/** * Gets the next memory segment that has been filled with data by the reader. This method blocks until * such a segment is available, or until an error occurs in the reader, or the reader is closed. * <p> * WARNING: If this method is invoked without any segment ever returning (for example, because the * {@link #readBlock(MemorySegment)} method has not been invoked appropriately), the method may block * forever. * * @return The next memory segment from the reader's return queue. * @throws IOException Thrown, if an I/O error occurs in the reader while waiting for the request to return. */ @Override public MemorySegment getNextReturnedBlock() throws IOException { try { while (true) { final MemorySegment next = this.returnSegments.poll(1000, TimeUnit.MILLISECONDS); if (next != null) { return next; } else { if (this.closed) { throw new IOException("The reader has been asynchronously closed."); } checkErroneous(); } } } catch (InterruptedException iex) { throw new IOException("Reader was interrupted while waiting for the next returning segment."); } }
/** * Gets the next memory segment that has been filled with data by the reader. This method blocks until * such a segment is available, or until an error occurs in the reader, or the reader is closed. * <p> * WARNING: If this method is invoked without any segment ever returning (for example, because the * {@link #readBlock(MemorySegment)} method has not been invoked appropriately), the method may block * forever. * * @return The next memory segment from the reader's return queue. * @throws IOException Thrown, if an I/O error occurs in the reader while waiting for the request to return. */ @Override public MemorySegment getNextReturnedBlock() throws IOException { try { while (true) { final MemorySegment next = this.returnSegments.poll(1000, TimeUnit.MILLISECONDS); if (next != null) { return next; } else { if (this.closed) { throw new IOException("The reader has been asynchronously closed."); } checkErroneous(); } } } catch (InterruptedException iex) { throw new IOException("Reader was interrupted while waiting for the next returning segment."); } }
/** * Gets the next memory segment that has been filled with data by the reader. This method blocks until * such a segment is available, or until an error occurs in the reader, or the reader is closed. * <p> * WARNING: If this method is invoked without any segment ever returning (for example, because the * {@link #readBlock(MemorySegment)} method has not been invoked appropriately), the method may block * forever. * * @return The next memory segment from the reader's return queue. * @throws IOException Thrown, if an I/O error occurs in the reader while waiting for the request to return. */ @Override public MemorySegment getNextReturnedBlock() throws IOException { try { while (true) { final MemorySegment next = this.returnSegments.poll(1000, TimeUnit.MILLISECONDS); if (next != null) { return next; } else { if (this.closed) { throw new IOException("The reader has been asynchronously closed."); } checkErroneous(); } } } catch (InterruptedException iex) { throw new IOException("Reader was interrupted while waiting for the next returning segment."); } }