Example #1
0
void
SqlPool::add_source(const SqlSource &source)
{
    sources_[source.id()] = source;
    counts_[source.id()] = 0;
    pools_[source.id()] = Pool();
}
Example #2
0
bool
SqlPool::reconnect(SqlConnectionPtr &conn)
{
    const SqlSource source = conn->get_source();
    const String &source_id = source.id();
    put(conn, true); // close now
    LOG(ll_DEBUG, _T("reopening connection") + format_stats(source_id));
    ScopedLock lock(pool_mux_);
    conn = new SqlConnection(source);
    ++counts_[source_id];
    LOG(ll_INFO, _T("reopened connection") + get_stats(source_id));
    return true;
}