|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.runtime.QueueIterator org.eigenbase.runtime.ThreadIterator net.sf.farrago.runtime.FarragoJavaUdxIterator
public abstract class FarragoJavaUdxIterator
FarragoJavaUdxIterator provides runtime support for a call to a Java UDX. It
supports both the blocking interface Iterator
and the non-blocking
TupleIter
.
Nested Class Summary | |
---|---|
class |
FarragoJavaUdxIterator.PreparedStatementInvocationHandler
|
Nested classes/interfaces inherited from class org.eigenbase.runtime.QueueIterator |
---|
QueueIterator.TimeoutException |
Nested classes/interfaces inherited from interface org.eigenbase.runtime.TupleIter |
---|
TupleIter.NoDataReason, TupleIter.TimeoutException |
Field Summary | |
---|---|
private long |
defaultTimeout
|
private int |
iRow
|
private CountDownLatch |
latch
|
private ParameterMetaData |
parameterMetaData
|
private static int |
QUEUE_ARRAY_SIZE
|
private List<TupleIter> |
restartableInputs
|
private PreparedStatement |
resultInserter
|
private FarragoSyntheticObject[] |
rowObjs
|
protected FarragoSessionRuntimeContext |
runtimeContext
|
private boolean |
stopThread
|
private boolean |
timeoutAsUnderflow
|
protected static Logger |
tracer
|
Fields inherited from class org.eigenbase.runtime.QueueIterator |
---|
hasNext, next, queue, throwable |
Fields inherited from interface org.eigenbase.runtime.TupleIter |
---|
EMPTY_ITERATOR |
Constructor Summary | |
---|---|
protected |
FarragoJavaUdxIterator(FarragoSessionRuntimeContext runtimeContext,
Class rowClass,
RelDataType rowType)
|
Method Summary | |
---|---|
protected void |
addRestartableInput(TupleIter inputIter)
Called by generated code to add an input cursor's iterator so that it can be restarted as needed. |
private void |
checkCancel()
|
void |
closeAllocation()
Closes this object. |
protected void |
doWork()
The implementation should call QueueIterator.put(java.lang.Object) with each row. |
protected abstract void |
executeUdx()
Calls specific UDX to produce result set. |
Object |
fetchNext()
Returns the next element in the iteration. |
FarragoSyntheticObject |
getCurrentRow()
|
PreparedStatement |
getResultInserter()
|
boolean |
hasNext()
|
boolean |
hasNext(long timeout)
As QueueIterator.hasNext , but throws QueueIterator.TimeoutException if no row is
available within the timeout. |
void |
restart()
Restarts this iterator, so that a subsequent call to next() returns the first element in the collection being iterated. |
boolean |
setTimeout(long timeout,
boolean asUnderflow)
Sets a timeout for TupleIter.fetchNext() ; (optional operation). |
private void |
startWithLatch()
|
private void |
stopWithLatch()
|
Methods inherited from class org.eigenbase.runtime.ThreadIterator |
---|
iterator, onEndOfQueue, run, start |
Methods inherited from class org.eigenbase.runtime.QueueIterator |
---|
checkTermination, done, next, next, offer, put, remove, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Iterator |
---|
next, remove |
Field Detail |
---|
private static final int QUEUE_ARRAY_SIZE
protected static final Logger tracer
private final FarragoSyntheticObject[] rowObjs
private final PreparedStatement resultInserter
protected final FarragoSessionRuntimeContext runtimeContext
private int iRow
private long defaultTimeout
private boolean timeoutAsUnderflow
private boolean stopThread
private CountDownLatch latch
private final ParameterMetaData parameterMetaData
private List<TupleIter> restartableInputs
Constructor Detail |
---|
protected FarragoJavaUdxIterator(FarragoSessionRuntimeContext runtimeContext, Class rowClass, RelDataType rowType)
Method Detail |
---|
public boolean hasNext()
hasNext
in interface Iterator
hasNext
in class QueueIterator
public boolean hasNext(long timeout) throws QueueIterator.TimeoutException
QueueIterator
QueueIterator.hasNext
, but throws QueueIterator.TimeoutException
if no row is
available within the timeout.
hasNext
in class QueueIterator
timeout
- Milliseconds to wait; less than or equal to zero
means don't wait
QueueIterator.TimeoutException
public boolean setTimeout(long timeout, boolean asUnderflow)
TupleIter
TupleIter.fetchNext()
; (optional operation). Not
all implementing classes support a timeout. For those that do, this
method provides a common interface, For those that do not, the adapter
TimeoutQueueTupleIter
puts a timeout queue on top.
setTimeout
in interface TupleIter
timeout
- in milliseconds. 0 means poll, infinity means block.asUnderflow
- true means indicate timeout by returning TupleIter.NoDataReason.UNDERFLOW
; false means throw TupleIter.TimeoutException
on a timeout.
public Object fetchNext()
TupleIter
TupleIter.NoDataReason
enumeration indicating why
no data was returned.
If this method returns TupleIter.NoDataReason.END_OF_DATA
, no further
data will be returned by this iterator unless TupleIter.restart()
is called.
If this method returns TupleIter.NoDataReason.UNDERFLOW
, no data is
currently available, but may be come available in the future. It is
possible for consecutive calls to return UNDERFLOW and then END_OF_DATA.
The object returned by this method may be re-used for each subsequent
call to fetchNext()
. In other words, callers must either
make certain that the returned value is no longer needed or is copied
before any subsequent calls to fetchNext()
.
fetchNext
in interface TupleIter
TupleIter.NoDataReason
.protected void addRestartableInput(TupleIter inputIter)
inputIter
- input cursor's iteratorprotected void doWork()
ThreadIterator
QueueIterator.put(java.lang.Object)
with each row.
doWork
in class ThreadIterator
public PreparedStatement getResultInserter()
public FarragoSyntheticObject getCurrentRow()
public void restart()
RestartableIterator
restart
in interface RestartableIterator
restart
in interface TupleIter
public void closeAllocation()
ClosableAllocation
closeAllocation
in interface ClosableAllocation
private void stopWithLatch()
private void startWithLatch()
private void checkCancel()
protected abstract void executeUdx()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |