At sufficiently low temperatures, the configurational phase space of a large spin-glass system breaks into many separated domains, each of which is referred to as a macroscopic state. The system is able to visit all spin configurations of the same macroscopic state, while it can not spontaneously jump between two different macroscopic states. Ergodicity of the whole configurational phase space of the system, however, can be recovered if a temperature-annealing process is repeated an infinite number of times. In a heating-annealing cycle, the environmental temperature is first elevated to a high level and then decreased extremely slowly until a final low temperature T is reached. Different macroscopic states may be reached in different rounds of the annealing experiment; while the probability of finding the system in macroscopic state ? decreases exponentially with the free energy F α(T) of this state. For finite-connectivity spin glass systems, we use this free energy Boltzmann distribution to formulate the cavity approach of M?zard and Parisi [Eur. Phys. J. B, 2001, 20: 217] in a slightly different form. For the ?J spin-glass model on a random regular graph of degree K = 6, the predictions of the present work agree with earlier simulational and theoretical results.