Package 

Class CellSelector


  • 
    public final class CellSelector
    
                        

    Canonical 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.

    • Method Summary

      Modifier and Type Method Description
      final CellEndpoint select() Run the selection algorithm.
      final CellEndpoint active() Current active cell.
      final CellEndpoint runHealthChecks() Run health checks against every endpoint.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.

      • runHealthChecks

         final CellEndpoint runHealthChecks()

        Run health checks against every endpoint. Flip their healthy flag. If the active endpoint turned unhealthy, re-run selection.