DBClientBase* DBConnectionPool::get(const ConnectionString& url) { DBClientBase * c = _get( url.toString() ); if ( c ){ onHandedOut( c ); return c; } string errmsg; c = url.connect( errmsg ); uassert( 13328 , _name + ": connect failed " + url.toString() + " : " + errmsg , c ); return _finishCreate( url.toString() , c ); }
DBClientBase* DBConnectionPool::get(const string& host) { DBClientBase * c = _get( host ); if ( c ){ onHandedOut( c ); return c; } string errmsg; ConnectionString cs = ConnectionString::parse( host , errmsg ); uassert( 13071 , (string)"invalid hostname [" + host + "]" + errmsg , cs.isValid() ); c = cs.connect( errmsg ); uassert( 11002 , _name + ": connect failed " + host + " : " + errmsg , c ); return _finishCreate( host , c ); }
DBClientBase* DBConnectionPool::get(const string& host) { DBClientBase * c = _get( host ); if ( c ) { onHandedOut( c ); return c; } string errmsg; ConnectionString cs = ConnectionString::parse( host , errmsg ); uassert( 13071 , (string)"invalid hostname [" + host + "]" + errmsg , cs.isValid() ); c = cs.connect( errmsg ); if ( ! c ) throw SocketException( SocketException::CONNECT_ERROR , host , 11002 , str::stream() << _name << " error: " << errmsg ); return _finishCreate( host , c ); }
DBClientBase* DBConnectionPool::get(const ConnectionString& url, double socketTimeout) { DBClientBase * c = _get( url.toString() , socketTimeout ); if ( c ) { try { onHandedOut( c ); } catch ( std::exception& ) { delete c; throw; } return c; } string errmsg; c = url.connect( errmsg, socketTimeout ); uassert( 13328 , _name + ": connect failed " + url.toString() + " : " + errmsg , c ); return _finishCreate( url.toString() , socketTimeout , c ); }