CloseableIterator<T>, Closeable, AutoCloseable, Iterator<T>public class AsyncBufferedIterator<T> extends Object implements CloseableIterator<T>
| Constructor | Description |
|---|---|
AsyncBufferedIterator(Iterator<T> iterator,
int bufferSize) |
Creates a new iterator that traverses the given iterator on a background
thread
|
AsyncBufferedIterator(Iterator<T> iterator,
int bufferSize,
int bufferCount) |
Creates a new iterator that traverses the given iterator on a background
thread
|
AsyncBufferedIterator(Iterator<T> iterator,
int bufferSize,
int bufferCount,
String threadName) |
Creates a new iterator that traverses the given iterator on a background
thread
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Should be implemented to close/release any underlying resources.
|
protected String |
getThreadNamePrefix() |
|
boolean |
hasNext() |
|
T |
next() |
stream, toListforEachRemaining, removepublic AsyncBufferedIterator(Iterator<T> iterator, int bufferSize)
iterator - iterator to traversebufferSize - size of read-ahead buffer. A larger size will increase both throughput and latency.
Double buffering is used so the maximum number of records on which read-ahead is performed is twice this.public AsyncBufferedIterator(Iterator<T> iterator, int bufferSize, int bufferCount)
iterator - iterator to traversebufferSize - size of each read-ahead buffer. A larger size will increase both throughput and latency.bufferCount - number of read-ahead bufferspublic AsyncBufferedIterator(Iterator<T> iterator, int bufferSize, int bufferCount, String threadName)
iterator - iterator to traversebufferSize - size of each read-ahead buffer. A larger size will increase both throughput and latency.bufferCount - number of read-ahead buffersthreadName - background thread name. A name will be automatically generated if this parameter is null.protected String getThreadNamePrefix()
public void close()
CloseableIteratorclose in interface AutoCloseableclose in interface Closeableclose in interface CloseableIterator<T>