|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.runtime.AbstractTupleIter net.sf.farrago.runtime.FennelAbstractTupleIter net.sf.farrago.runtime.FennelPipeTupleIter
public class FennelPipeTupleIter
FennelPipeTupleIter implements the TupleIter
interface, receiving data from a producer as ByteBuffer
objects, and
unmarshalling them to a consumer.
A FennelPipeTupleIter has a C++ peer, a JavaSinkExecstream. The peer sends marshalled data, wrapped as a ByteBuffer. The reader has a current buffer from which it unmarshals rows on demand, and a queue of buffers to read next. The queue is synchronized; but it is left available to the writer between TupleIter calls (#fetchNext()). Otherwise, if it were unavailable for a long time, the peer XO would block, which is a severe problem for a single-thread XO scheduler.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eigenbase.runtime.TupleIter |
---|
TupleIter.NoDataReason, TupleIter.TimeoutException |
Field Summary | |
---|---|
private ArrayQueue<ByteBuffer> |
moreBuffers
buffers from the writer, not yet read |
protected static Logger |
tracer
|
Fields inherited from class net.sf.farrago.runtime.FennelAbstractTupleIter |
---|
bufferAsArray, byteBuffer, tupleReader |
Fields inherited from interface org.eigenbase.runtime.TupleIter |
---|
EMPTY_ITERATOR |
Constructor Summary | |
---|---|
FennelPipeTupleIter(FennelTupleReader tupleReader)
creates a new FennelPipeTupleIter object. |
Method Summary | |
---|---|
void |
closeAllocation()
Closes this object. |
private ByteBuffer |
dequeue()
Gets the head buffer from the queue. |
private void |
enqueue(ByteBuffer bb)
adds a buffer to the buffer queue. |
ByteBuffer |
getByteBuffer(int size)
Gets a direct ByteBuffer suitable for #write. |
protected int |
populateBuffer()
Populates the buffer with a new batch of data, and returns the size in bytes. |
void |
restart()
Restarts this iterator, so that a subsequent call to TupleIter.fetchNext() returns the first element in the collection being
iterated. |
protected void |
traceNext(Object val)
|
void |
write(ByteBuffer bb,
int bblen)
Writes the contents of a byte buffer into this iterator. |
Methods inherited from class net.sf.farrago.runtime.FennelAbstractTupleIter |
---|
fetchNext, getStatus, requestData |
Methods inherited from class org.eigenbase.runtime.AbstractTupleIter |
---|
setTimeout |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Logger tracer
private final ArrayQueue<ByteBuffer> moreBuffers
Constructor Detail |
---|
public FennelPipeTupleIter(FennelTupleReader tupleReader)
tupleReader
- FennelTupleReader to use to interpret Fennel dataMethod Detail |
---|
private void enqueue(ByteBuffer bb)
private ByteBuffer dequeue()
public void restart()
TupleIter
TupleIter.fetchNext()
returns the first element in the collection being
iterated.
restart
in interface TupleIter
restart
in class FennelAbstractTupleIter
protected void traceNext(Object val)
traceNext
in class FennelAbstractTupleIter
public void closeAllocation()
ClosableAllocation
protected int populateBuffer()
FennelAbstractTupleIter
populateBuffer
in class FennelAbstractTupleIter
public ByteBuffer getByteBuffer(int size)
public void write(ByteBuffer bb, int bblen) throws Throwable
byteBufer.hasArray() == true
). (Unfortunately the result
of JNI NewDirectByteBuffer() need not have a backing array).
This method is called by the producer, typically from JNI.
The limit of the byte buffer is ignored; the bblen
parameter is used instead.
bb
- A ByteBuffer containing the new databblen
- size of bb
in bytes; 0 means end of data.
Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |