-
public interface RecordInputSelectorProvides a mechanism to wait for data on a set ofRecordInputobjects. 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 intreadyIndex()Gets the index of the currently ready input.RecordInputreadyInput()Gets the currently ready input.longreadyTokens()Gets the maximum number of tokens guaranteed available on the ready input.booleanwaitForReadyInput()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
waitForReadyInputis 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,
falseis 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.
-1if 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.
nullis 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
-
-