Thermalization of mesons in ultrarelativistic heavy-ion reactions