Make connection pool thread safe