in src/dxapi/native/tickdb/http/tickdb_http.cpp [177:230]
void TickDbImpl::close()
{
srw_write section(thisLock_);
DBGLOG(LOGHDR ".close(%s)", ID, uri.full.c_str());
DBGLOG_VERBOSE(LOGHDR ".close(): flushing delayed exceptions", ID);
flushExceptions();
DBGLOG_VERBOSE(LOGHDR ".close(): stopping loader manager", ID);
size_t lc = loaderManager_.loadersCount();
const char *isOpenedStr = isOpened_ ? "Open" : "Closed";
if (0 != lc) {
DBGLOG_VERBOSE(LOGHDR ".close(): trying to stop %u orphaned loaders while deleting '%s' TickDB connection",
ID, (unsigned)lc, isOpenedStr);
}
else {
DBGLOG(LOGHDR ".close(): No orphaned loaders", ID);
}
loaderManager_.stop();
sessionHandler_.stop();
if (isOpen()) {
concurrent_ptr_set_iter iter(cursors_);
if (iter.size()) {
DBGLOG(LOGHDR ".close(): trying to stop %u orphaned cursors while deleting '%s' TickDB connection",
ID, (unsigned)iter.size(), isOpenedStr);
TickCursorImpl * i;
while (NULL != (i = (TickCursorImpl *)iter.next())) {
if (cursors_.find(i)) {
i->close(isOpened_, true); // No throw, we want to close all cursors no matter what
}
}
DBGLOG(LOGHDR ".close(): done", ID, (unsigned)iter.size());
}
else {
DBGLOG(LOGHDR ".close(): No orphaned cursors", ID);
}
// Maybe move this code here
/*auto streams = streamCache_.allStreams();
for (auto i : streams) {
assert(NULL != i);
if (NULL != i) while (LockType::NO_LOCK != impl(i)->unlock()) {}
}*/
DBGLOG(LOGHDR ".close(): No orphaned cursors", ID);
streamCache_.clear();
this->isOpened_ = false;
}
isClosed_ = true;
}