/** Broadcast the results from the query to all registered callback objects. */
  private void broadcastQueryResults(AsyncResult ar) {
    // reset the state.
    synchronized (mCallbacks) {
      mState = QUERY_READY;

      // see if we need to do any work.
      if (ar == null) {
        if (DBG) {
          log("AsyncResult is null.");
        }
        return;
      }

      // TODO: we may need greater accuracy here, but for now, just a
      // simple status integer will suffice.
      int exception = (ar.exception == null) ? QUERY_OK : QUERY_EXCEPTION;
      if (DBG) {
        log("AsyncResult has exception " + exception);
      }

      // Make the calls to all the registered callbacks.
      for (int i = (mCallbacks.beginBroadcast() - 1); i >= 0; i--) {
        INetworkQueryServiceCallback cb = mCallbacks.getBroadcastItem(i);
        if (DBG) {
          log("broadcasting results to " + cb.getClass().toString());
        }
        try {
          cb.onQueryComplete((ArrayList<OperatorInfo>) ar.result, exception);
        } catch (RemoteException e) {
          log("e = " + e);
        }
      }

      // finish up.
      mCallbacks.finishBroadcast();
    }
  }