-
public interface RecordInputSelector
Provides a mechanism to wait for data on a set ofRecordInput
objects. This is typically used to implement operators which combine inputs without any special regards to ordering. Care should be taken to try to service all inputs equally to avoid introducing queue expansion.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
readyIndex()
Gets the index of the currently ready input.RecordInput
readyInput()
Gets the currently ready input.long
readyTokens()
Gets the maximum number of tokens guaranteed available on the ready input.boolean
waitForReadyInput()
Waits until there is data available on one of the registered inputs.
-
-
-
Method Detail
-
waitForReadyInput
boolean waitForReadyInput()
Waits until there is data available on one of the registered inputs. On return, either no more data is available or data is available on the input indicated byreadyInput()
.Waiting attempts to be fair. If
waitForReadyInput
is invoked while the currently ready input still has data, a new current input will be found, if one is available.- Returns:
- whether any input is still live. If all registered inputs
have reached end of data,
false
is returned.
-
readyIndex
int readyIndex()
Gets the index of the currently ready input. Indexing matches the ordering provided when initially constructing the selector.- Returns:
- the index of the ready input using the ordering of the initial
list of inputs.
-1
if no input is ready, as is the case initially or after all inputs are at EOD.
-
readyInput
RecordInput readyInput()
Gets the currently ready input. Upon return fromwaitForReadyInput()
, it is guaranteed that the first call tostepNext()
on this input will not block, although subsequent calls may.- Returns:
- an input which had at least one token available for reading.
null
is returned if there is no input ready, as is the case initially or after all inputs are at EOD.
-
readyTokens
long readyTokens()
Gets the maximum number of tokens guaranteed available on the ready input. Stepping more than this number of tokens may block.- Returns:
- the number of tokens currently available without blocking on the input
-
-