本文整理汇总了C++中StoredConnection::ok方法的典型用法代码示例。如果您正苦于以下问题:C++ StoredConnection::ok方法的具体用法?C++ StoredConnection::ok怎么用?C++ StoredConnection::ok使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StoredConnection
的用法示例。
在下文中一共展示了StoredConnection::ok方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: time
DBClientBase * PoolForHost::get() {
time_t now = time(0);
while ( ! _pool.empty() ){
StoredConnection sc = _pool.top();
_pool.pop();
if ( sc.ok( now ) )
return sc.conn;
delete sc.conn;
}
return NULL;
}
示例2: getStaleConnections
void PoolForHost::getStaleConnections(vector<DBClientBase*>& stale) {
time_t now = time(0);
vector<StoredConnection> all;
while (!_pool.empty()) {
StoredConnection c = _pool.top();
_pool.pop();
if (c.ok(now))
all.push_back(c);
else
stale.push_back(c.conn);
}
for (size_t i = 0; i < all.size(); i++) {
_pool.push(all[i]);
}
}
示例3: get
DBClientBase* PoolForHost::get(DBConnectionPool* pool, double socketTimeout) {
time_t now = time(0);
while (!_pool.empty()) {
StoredConnection sc = _pool.top();
_pool.pop();
if (!sc.ok(now)) {
pool->onDestroy(sc.conn);
delete sc.conn;
continue;
}
verify(sc.conn->getSoTimeout() == socketTimeout);
return sc.conn;
}
return NULL;
}