-
public final class CellSelectorCanonical multi-region cell-selection algorithm. Pinned by libs/mobile-sdk/tests/drift/cell-selection.json.
Order of operations:
If preferredRegion is set AND that endpoint is healthy → pick it.
Else if autoRegionDetection → probe every healthy /health, pick lowest latency.
Else → sort healthy endpoints by priority asc, pick first.
Else → null (caller fails closed; no events transmitted).
Health checks run on a 60s tick; if the active cell turns unhealthy the selector re-runs the algorithm and updates the active endpoint in place.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classCellSelector.Companion
-
Constructor Summary
Constructors Constructor Description CellSelector(List<CellEndpoint> endpoints, CellRegion preferredRegion, Boolean autoRegionDetection, OkHttpClient httpClient)
-
Method Summary
Modifier and Type Method Description final CellEndpointselect()Run the selection algorithm. final CellEndpointactive()Current active cell. final CellEndpointrunHealthChecks()Run health checks against every endpoint. -
-
Constructor Detail
-
CellSelector
CellSelector(List<CellEndpoint> endpoints, CellRegion preferredRegion, Boolean autoRegionDetection, OkHttpClient httpClient)
-
-
Method Detail
-
select
final CellEndpoint select()
Run the selection algorithm. Blocks for at most ~2s per healthy cell when autoRegionDetection is enabled; returns immediately otherwise. Caller should invoke off the main thread.
-
active
final CellEndpoint active()
Current active cell. Null until select has been called.
-
runHealthChecks
final CellEndpoint runHealthChecks()
Run health checks against every endpoint. Flip their healthy flag. If the active endpoint turned unhealthy, re-run selection.
-
-
-
-