Interface SchedulingConnector.IScheduler

Enclosing class:
SchedulingConnector

public static interface SchedulingConnector.IScheduler
Schedules channels that have outgoing buffers. Implementations must not perform transport I/O.
Since:
4.23
Author:
Eike Stepper
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears the current selection and all scheduled channels, typically during connector deactivation.
    boolean
    complete(InternalChannel channel, boolean bufferCompleted)
    Completes or retains the current channel after a send attempt.
    boolean
    Returns whether channels are scheduled.
    boolean
    Offers a channel with queued outgoing work.
    boolean
    Removes a channel from the scheduling order, for example after deactivation.
    Selects the current channel without rotating it.
  • Method Details

    • offer

      boolean offer(InternalChannel channel)
      Offers a channel with queued outgoing work.
      Parameters:
      channel - a channel whose send queue may contain pending buffers
      Returns:
      true if this offer caused an idle scheduler to become nonempty
    • select

      InternalChannel select()
      Selects the current channel without rotating it. Repeated calls return the same channel until its buffer completes or it is removed.
      Returns:
      the selected channel, or null if no channel has pending work
    • complete

      boolean complete(InternalChannel channel, boolean bufferCompleted)
      Completes or retains the current channel after a send attempt. An incomplete buffer remains selected so a transport can resume it without interleaving another channel's buffer. After a successful completion, the connector requests another send attempt if any channel remains scheduled. This request must be asynchronous so it cannot send reentrantly from the completion callback.
      Parameters:
      channel - the channel that was selected
      bufferCompleted - true only after the complete buffer was transmitted successfully
      Returns:
      true if the completion was for the current channel and at least one channel remains scheduled
    • remove

      boolean remove(InternalChannel channel)
      Removes a channel from the scheduling order, for example after deactivation.
      Parameters:
      channel - the channel to remove
      Returns:
      true if the removed channel was current and other scheduled work remains
    • isEmpty

      boolean isEmpty()
      Returns whether channels are scheduled.
      Returns:
      true if the scheduler has no pending channels
    • clear

      void clear()
      Clears the current selection and all scheduled channels, typically during connector deactivation.