summaryrefslogtreecommitdiff
path: root/src/mongo/client/connpool.h
diff options
context:
space:
mode:
authorRanjay Krishna <rak248@cornell.edu>2013-12-18 15:24:59 -0500
committerMatt Kangas <matt.kangas@mongodb.com>2013-12-28 11:32:36 -0500
commit6c5777102a973d9b5e41619f2315b75da3be3084 (patch)
treeb48935c1c54fa147de9608bca0d8f266e94ed54f /src/mongo/client/connpool.h
parente63ebb10569e05b65a34071f0a9360374b4d7139 (diff)
downloadmongo-6c5777102a973d9b5e41619f2315b75da3be3084.tar.gz
SERVER-3364 Label rest of client api with MONGO_CLIENT_API
build all the sharedclient programs using the new macro MONGO_CLIENT_API in mongo/client/export_macros.h Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
Diffstat (limited to 'src/mongo/client/connpool.h')
-rw-r--r--src/mongo/client/connpool.h35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h
index 30e78d2a2fd..694ce53d6dc 100644
--- a/src/mongo/client/connpool.h
+++ b/src/mongo/client/connpool.h
@@ -19,9 +19,10 @@
#include <stack>
-#include "mongo/util/background.h"
#include "mongo/client/dbclientinterface.h"
+#include "mongo/client/export_macros.h"
#include "mongo/platform/cstdint.h"
+#include "mongo/util/background.h"
namespace mongo {
@@ -32,7 +33,7 @@ namespace mongo {
* not thread safe
* thread safety is handled by DBConnectionPool
*/
- class PoolForHost {
+ class MONGO_CLIENT_API PoolForHost {
public:
PoolForHost()
: _created(0), _minValidCreationTimeMicroSec(0) {}
@@ -64,7 +65,7 @@ namespace mongo {
void done( DBConnectionPool * pool , DBClientBase * c );
void flush();
-
+
void getStaleConnections( vector<DBClientBase*>& stale );
/**
@@ -99,7 +100,7 @@ namespace mongo {
std::string _hostName;
std::stack<StoredConnection> _pool;
-
+
int64_t _created;
uint64_t _minValidCreationTimeMicroSec;
ConnectionString::ConnectionType _type;
@@ -130,8 +131,8 @@ namespace mongo {
c.conn()...
}
*/
- class DBConnectionPool : public PeriodicTask {
-
+ class MONGO_CLIENT_API DBConnectionPool : public PeriodicTask {
+
public:
DBConnectionPool();
@@ -179,15 +180,15 @@ namespace mongo {
};
virtual string taskName() const { return "DBConnectionPool-cleaner"; }
- virtual void taskDoWork();
+ virtual void taskDoWork();
private:
DBConnectionPool( DBConnectionPool& p );
-
+
DBClientBase* _get( const string& ident , double socketTimeout );
DBClientBase* _finishCreate( const string& ident , double socketTimeout, DBClientBase* conn );
-
+
struct PoolKey {
PoolKey( const std::string& i , double t ) : ident( i ) , timeout( t ) {}
string ident;
@@ -202,27 +203,27 @@ namespace mongo {
mongo::mutex _mutex;
string _name;
-
+
PoolMap _pools;
// pointers owned by me, right now they leak on shutdown
// _hooks itself also leaks because it creates a shutdown race condition
- list<DBConnectionHook*> * _hooks;
+ list<DBConnectionHook*> * _hooks;
};
- extern DBConnectionPool pool;
+ extern MONGO_CLIENT_API DBConnectionPool pool;
- class AScopedConnection : boost::noncopyable {
+ class MONGO_CLIENT_API AScopedConnection : boost::noncopyable {
public:
AScopedConnection() { _numConnections++; }
virtual ~AScopedConnection() { _numConnections--; }
-
+
virtual DBClientBase* get() = 0;
virtual void done() = 0;
virtual string getHost() const = 0;
-
- /**
+
+ /**
* @return true iff this has a connection to the db
*/
virtual bool ok() const = 0;
@@ -240,7 +241,7 @@ namespace mongo {
clean up nicely (i.e. the socket gets closed automatically when the
scopeddbconnection goes out of scope).
*/
- class ScopedDbConnection : public AScopedConnection {
+ class MONGO_CLIENT_API ScopedDbConnection : public AScopedConnection {
public:
/** the main constructor you want to use
throws UserException if can't connect