summaryrefslogtreecommitdiff
path: root/src/mongo/client/connpool.h
diff options
context:
space:
mode:
authorsamantharitter <samantha.ritter@10gen.com>2017-04-14 18:40:24 -0400
committersamantharitter <samantha.ritter@10gen.com>2017-04-15 09:50:13 -0400
commit0dc375a32b24a65fd93e6d669aca05f7309f78df (patch)
tree84eb88991d249705004d9aa4e425f14a484048b6 /src/mongo/client/connpool.h
parent6408dcd1b5f4fa1747fa2acac50b8cd004343ca7 (diff)
downloadmongo-0dc375a32b24a65fd93e6d669aca05f7309f78df.tar.gz
SERVER-28760 Add egress logging to DBConnectionPool
Diffstat (limited to 'src/mongo/client/connpool.h')
-rw-r--r--src/mongo/client/connpool.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h
index 4599a6fdf30..7ce7022390e 100644
--- a/src/mongo/client/connpool.h
+++ b/src/mongo/client/connpool.h
@@ -103,6 +103,13 @@ public:
_maxPoolSize = maxPoolSize;
}
+ /**
+ * Sets the socket timeout on this host, for reporting purposes only.
+ */
+ void setSocketTimeout(double socketTimeout) {
+ _socketTimeout = socketTimeout;
+ }
+
int numAvailable() const {
return (int)_pool.size();
}
@@ -111,6 +118,13 @@ public:
return _checkedOut;
}
+ /**
+ * Returns the number of open connections in this pool.
+ */
+ int openConnections() const {
+ return numInUse() + numAvailable();
+ }
+
void createdOne(DBClientBase* base);
long long numCreated() const {
return _created;
@@ -163,6 +177,7 @@ private:
};
std::string _hostName;
+ double _socketTimeout;
std::stack<StoredConnection> _pool;
int64_t _created;
@@ -224,6 +239,11 @@ public:
}
/**
+ * Returns the number of connections to the given host pool.
+ */
+ int openConnections(const std::string& ident, double socketTimeout);
+
+ /**
* Sets the maximum number of connections pooled per-host.
*
* This setting only applies to new host connection pools, previously-pooled host pools are