本文整理汇总了C++中DBConnectionPool::isConnectionGood方法的典型用法代码示例。如果您正苦于以下问题:C++ DBConnectionPool::isConnectionGood方法的具体用法?C++ DBConnectionPool::isConnectionGood怎么用?C++ DBConnectionPool::isConnectionGood使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnectionPool
的用法示例。
在下文中一共展示了DBConnectionPool::isConnectionGood方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: done
void done( const string& addr , DBClientBase* conn ) {
Status* s = _hosts[addr];
verify( s );
const bool isConnGood = shardConnectionPool.isConnectionGood(addr, conn);
if (s->avail != NULL) {
warning() << "Detected additional sharded connection in the "
"thread local pool for " << addr << endl;
if (DBException::traceExceptions) {
// There shouldn't be more than one connection checked out to the same
// host on the same thread.
printStackTrace();
}
if (!isConnGood) {
delete s->avail;
s->avail = NULL;
}
// Let the internal pool handle the bad connection, this can also
// update the lower bounds for the known good socket creation time
// for this host.
release(addr, conn);
return;
}
if (!isConnGood) {
// Let the internal pool handle the bad connection.
release(addr, conn);
return;
}
// Note: Although we try our best to clear bad connections as much as possible,
// some of them can still slip through because of how ClientConnections are being
// used - as thread local variables. This means that threads won't be able to
// see the s->avail connection of other threads.
s->avail = conn;
}