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 TypeMethodDescriptionvoidclear()Clears the current selection and all scheduled channels, typically during connector deactivation.booleancomplete(InternalChannel channel, boolean bufferCompleted) Completes or retains the current channel after a send attempt.booleanisEmpty()Returns whether channels are scheduled.booleanoffer(InternalChannel channel) Offers a channel with queued outgoing work.booleanremove(InternalChannel channel) Removes a channel from the scheduling order, for example after deactivation.select()Selects the current channel without rotating it.
-
Method Details
-
offer
Offers a channel with queued outgoing work.- Parameters:
channel- a channel whose send queue may contain pending buffers- Returns:
trueif 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
nullif no channel has pending work
-
complete
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 selectedbufferCompleted-trueonly after the complete buffer was transmitted successfully- Returns:
trueif the completion was for the current channel and at least one channel remains scheduled
-
remove
Removes a channel from the scheduling order, for example after deactivation.- Parameters:
channel- the channel to remove- Returns:
trueif the removed channel was current and other scheduled work remains
-
isEmpty
boolean isEmpty()Returns whether channels are scheduled.- Returns:
trueif the scheduler has no pending channels
-
clear
void clear()Clears the current selection and all scheduled channels, typically during connector deactivation.
-