Beam heating and cooling of thick targets for on-line production of exotic nuclei