Interface RecordInputSelector


  • public interface RecordInputSelector
    Provides a mechanism to wait for data on a set of RecordInput 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 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 by readyInput().

        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 from waitForReadyInput(), it is guaranteed that the first call to stepNext() 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