[SPARK-3106] Fix the race condition issue about Connection and ConnectionManager

Incorrect change, please see above.