...
The coordinator discovery process piggybacks on an event loop running on the background thread loop; therefore, any disconnect or connection request is handled by the state machine, and the state machine is run by the background thread loop. If . The event loop polls events from the queue, and handles coordinator connection on demand, i.e., if we don't need a coordinator, the background thread will stay in the initialized state. If an event requires a coordinator, we will then move to the coordinator_discovery state and wait for the response to come back.
...