code: private void shutdownNameResolverAndLoadBalancer(boolean channelIsActive) {
      syncContext.throwIfNotInThisSynchronizationContext();
      if (channelIsActive) {
        checkState(nameResolverStarted, "nameResolver is not started");
        checkState(lbHelper != null, "lbHelper is null");
      }
      if (nameResolver != null) {
        cancelNameResolverBackoff();
        nameResolver.shutdown();
        nameResolverStarted = false;
        if (channelIsActive) {
          nameResolver = getNameResolver(target, nameResolverFactory, nameResolverHelper);
        } else {
          nameResolver = null;
        }
      }
      if (lbHelper != null) {
        lbHelper.lb.shutdown();
        lbHelper = null;
      }
      subchannelPicker = null;
    }
docs: Must be called from syncContext