Why changing to synchronized class is necessary?