Thread safe connection pool