Class RemoteInputChannel


  • public class RemoteInputChannel
    extends InputChannel
    An input channel, which requests a remote partition queue.
    • Method Detail

      • increaseBackoff

        protected boolean increaseBackoff()
        The remote task manager creates partition request listener and returns PartitionNotFoundException until the listener is timeout, so the backoff should add the timeout milliseconds if it exists.
        Overrides:
        increaseBackoff in class InputChannel
        Returns:
        true, iff the operation was successful. Otherwise, false.
      • peekNextBufferSubpartitionIdInternal

        protected int peekNextBufferSubpartitionIdInternal()
                                                    throws IOException
        Description copied from class: InputChannel
        Returns the index of the subpartition where the next buffer locates, or -1 if there is no buffer available and the subpartition to be consumed is not determined.
        Specified by:
        peekNextBufferSubpartitionIdInternal in class InputChannel
        Throws:
        IOException
      • isReleased

        public boolean isReleased()
      • getNumberOfAvailableBuffers

        @VisibleForTesting
        public int getNumberOfAvailableBuffers()
      • notifyBufferAvailable

        public void notifyBufferAvailable​(int numAvailableBuffers)
                                   throws IOException
        The unannounced credit is increased by the given amount and might notify increased credit to the producer.
        Overrides:
        notifyBufferAvailable in class InputChannel
        Throws:
        IOException
      • getUnannouncedCredit

        public int getUnannouncedCredit()
        Gets the currently unannounced credit.
        Returns:
        Credit which was not announced to the sender yet.
      • getAndResetUnannouncedCredit

        public int getAndResetUnannouncedCredit()
        Gets the unannounced credit and resets it to 0 atomically.
        Returns:
        Credit which was not announced to the sender yet.
      • getNumberOfQueuedBuffers

        public int getNumberOfQueuedBuffers()
        Gets the current number of received buffers which have not been processed yet.
        Returns:
        Buffers queued for processing.
      • unsynchronizedGetExclusiveBuffersUsed

        public int unsynchronizedGetExclusiveBuffersUsed()
      • unsynchronizedGetFloatingBuffersAvailable

        public int unsynchronizedGetFloatingBuffersAvailable()
      • getInitialCredit

        public int getInitialCredit()
      • requestBuffer

        @Nullable
        public Buffer requestBuffer()
        Requests buffer from input channel directly for receiving network data. It should always return an available buffer in credit-based mode unless the channel has been released.
        Returns:
        The available buffer.
      • onSenderBacklog

        public void onSenderBacklog​(int backlog)
                             throws IOException
        Receives the backlog from the producer's buffer response. If the number of available buffers is less than backlog + initialCredit, it will request floating buffers from the buffer manager, and then notify unannounced credits to the producer.
        Parameters:
        backlog - The number of unsent buffers in the producer's sub partition.
        Throws:
        IOException
      • onBuffer

        public void onBuffer​(Buffer buffer,
                             int sequenceNumber,
                             int backlog,
                             int subpartitionId)
                      throws IOException
        Handles the input buffer. This method is taking over the ownership of the buffer and is fully responsible for cleaning it up both on the happy path and in case of an error.
        Throws:
        IOException
      • checkpointStopped

        public void checkpointStopped​(long checkpointId)
        Description copied from class: InputChannel
        Called by task thread on cancel/complete to clean-up temporary data.
        Overrides:
        checkpointStopped in class InputChannel
      • onEmptyBuffer

        public void onEmptyBuffer​(int sequenceNumber,
                                  int backlog)
                           throws IOException
        Throws:
        IOException
      • onFailedPartitionRequest

        public void onFailedPartitionRequest()
      • onError

        public void onError​(Throwable cause)
      • notifyRequiredSegmentId

        public void notifyRequiredSegmentId​(int subpartitionId,
                                            int segmentId)
                                     throws IOException
        Description copied from class: InputChannel
        Notify the upstream the id of required segment that should be sent to netty connection.
        Overrides:
        notifyRequiredSegmentId in class InputChannel
        Parameters:
        subpartitionId - The id of the corresponding subpartition.
        segmentId - The id of required segment.
        Throws:
        IOException