Make getObj in the *Generator classes thread safe

Make getObj in the *Generator classes thread safe by not returning pointer to member data obj_.