public abstract class BlockingQueueReader<E> extends DataReader<E>
DataReader that uses a
BlockingQueue for getting input.
The only missing part is implementation for
estimateSizeInBytes(Object), since there is no way
to provide a meaningful estimate without knowing object type.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_closed |
protected E |
_endMarker |
protected BlockingQueue<E> |
_queue |
| Constructor and Description |
|---|
BlockingQueueReader(BlockingQueue<E> q)
Deprecated.
|
BlockingQueueReader(BlockingQueue<E> q,
E endMarker) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Method for closing the reader.
|
abstract int |
estimateSizeInBytes(E item)
Method that should estimate memory usage of given item, for purpose
of limiting amount of data kept in memory during pre-sorting phase.
|
E |
readNext()
Method for reading the next data item; will return
null to indicate end of input, otherwise return a non-null
item.
|
protected final BlockingQueue<E> _queue
protected final E _endMarker
protected boolean _closed
@Deprecated public BlockingQueueReader(BlockingQueue<E> q)
public BlockingQueueReader(BlockingQueue<E> q, E endMarker)
q - Queue to read entries fromendMarker - Value that is used to signal end-of-input; when this value
is gotten from queue, reader assumes that no more input is coming and
will return null from readNext().public void close()
throws IOException
DataReaderclose in class DataReader<E>IOExceptionpublic abstract int estimateSizeInBytes(E item)
DataReaderestimateSizeInBytes in class DataReader<E>public E readNext() throws IOException
DataReaderreadNext in class DataReader<E>IOExceptionCopyright © 2022 FasterXML. All rights reserved.