Regarding using ocilib::Pool to get links, what happens if the maximum link is reached? This is a code snippet I wrote, and I'm not sure if I need to do it. Or what should I do? Please advise.
class xxx
{
public:
inline ocilib::Connection getConnection()
{
std::unique_lock lock(m_mtx);
while (pool_.GetBusyConnectionsCount() >= pool_.GetMaxSize())
{
std::cerr << "connections resoures is poor ~ please waiting for ..." << std::endl;
m_cond.wait(lock, [this] {return pool_.GetBusyConnectionsCount() < pool_.GetMaxSize(); });
}
auto conn = std::move(pool_.GetConnection());
lock.unlock();
return conn;
}
///...
private:
ocilib::Pool pool_;
}
When oracle pool is full, requesting connection is a blocking call until the pool has an available one.
You can change that behaviour to no block using Pool::SetNoWait(false)
Regarding using ocilib::Pool to get links, what happens if the maximum link is reached? This is a code snippet I wrote, and I'm not sure if I need to do it. Or what should I do? Please advise.