ShortestQueueRouter

class ShortestQueueRouter(stations: List<Station>, comparator: Comparator<Station> = StationWIPComparator()) : Router(source)

Routes each arriving QObject to the station with the smallest work-in-process among stations, as ordered by comparator (default: fewest at station). This is the join-shortest-queue policy and generalizes the pick-station receiver.

Parameters

stations

the candidate stations, which must be non-empty

comparator

the ordering used to pick the "smallest" station

Constructors

Link copied to clipboard
constructor(stations: List<Station>, comparator: Comparator<Station> = StationWIPComparator())

Functions

Link copied to clipboard
open override fun destinations(): List<QObjectReceiverIfc>

The possible destinations this router may select, for graph introspection.

Link copied to clipboard

Selects the receiver for the supplied qObject. Implementations must return a non-null receiver; supply a default/fallback to guarantee this.