|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.striterator.AbstractChunkedResolverator<E,F,S>
E - The generic type of the elements visited by the source iterator.F - The generic type of the elements visited by this iterator (the
resolved elements).S - The generic type of the application state object.public abstract class AbstractChunkedResolverator<E,F,S>
Wraps an IChunkedIterator and asynchronously resolves chunks.
| Field Summary | |
|---|---|
protected static boolean |
DEBUG
True iff the log level is DEBUG or less. |
protected static org.apache.log4j.Logger |
log
|
protected S |
state
Application specified state object. |
| Constructor Summary | |
|---|---|
AbstractChunkedResolverator(S state,
IChunkedOrderedIterator<E> src,
BlockingBuffer<F[]> buffer)
|
|
| Method Summary | |
|---|---|
void |
close()
Closes the iterator, releasing any associated resources. |
boolean |
hasNext()
|
F |
next()
|
void |
remove()
|
protected abstract F[] |
resolveChunk(E[] chunk)
Resolves the elements in a source chunk, returning a chunk of resolved elements. |
AbstractChunkedResolverator<E,F,S> |
start(ExecutorService service)
Creates and runs a task that will consume chunks from the source iterator, resolve the elements in each chunk, and place the resolved chunks onto the BlockingBuffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger log
protected static final boolean DEBUG
log level is DEBUG or less.
protected final S state
| Constructor Detail |
|---|
public AbstractChunkedResolverator(S state,
IChunkedOrderedIterator<E> src,
BlockingBuffer<F[]> buffer)
state - Application specified state (optional).src - The source iterator (will be closed exhausted or when this
iterator is closed).buffer - The BlockingBuffer on which the resolved chunks will
be written by the ChunkConsumerTask and from which
this iterator will read those chunks.| Method Detail |
|---|
public AbstractChunkedResolverator<E,F,S> start(ExecutorService service)
BlockingBuffer.
You MUST invoke this before consuming results from the iterator.
Implementations SHOULD strengthen the return type.
service - The service on which the task will be executed.protected abstract F[] resolveChunk(E[] chunk)
Note: This method is invoked by the ChunkConsumerTask which runs
asynchronously.
chunk - The next chunk from the source iterator.
public boolean hasNext()
hasNext in interface Iterator<F>IllegalStateException - unless start(ExecutorService) has been invoked.public F next()
next in interface Iterator<F>public void remove()
remove in interface Iterator<F>UnsupportedOperationExceptionpublic void close()
ICloseableIterator
Note: Implementations that support Iterator.remove() MUST NOT
eagerly close the iterator when it is exhausted since that would make it
impossible to remove the last visited statement. Instead they MUST wait
for an explicit ICloseableIterator.close() by the application.
close in interface ICloseableIterator<F>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||