A barber who brandished a razor on a train while threatening to “kill all the English” and shouting about Jihad has been jailed for two years.