Permalink
Browse files

comments

  • Loading branch information...
1 parent 2884252 commit 681a993dd1c00f8f327267af2e875e005f396a47 @dwight dwight committed Oct 28, 2010
Showing with 8 additions and 4 deletions.
  1. +8 −4 client/connpool.h
View
@@ -141,18 +141,22 @@ namespace mongo {
};
/** Use to get a connection from the pool. On exceptions things
- clean up nicely.
+ clean up nicely (i.e. the socket gets closed automatically when the
+ scopeddbconnection goes out of scope).
*/
class ScopedDbConnection : public AScopedConnection {
public:
+ /** the main constructor you want to use
+ throws UserException if can't connect
+ */
+ explicit ScopedDbConnection(const string& host) : _host(host), _conn( pool.get(host) ) {}
+
ScopedDbConnection() : _host( "" ) , _conn(0) {}
+ /* @param conn - bind to an existing connection */
ScopedDbConnection(const string& host, DBClientBase* conn ) : _host( host ) , _conn( conn ) {}
/** throws UserException if can't connect */
- explicit ScopedDbConnection(const string& host) : _host(host), _conn( pool.get(host) ) {}
-
- /** throws UserException if can't connect */
explicit ScopedDbConnection(const ConnectionString& url ) : _host(url.toString()), _conn( pool.get(url) ) {}
/** throws UserException if can't connect */

0 comments on commit 681a993

Please sign in to comment.