32 boost::lock_guard<boost::mutex> lock(
m_mtx);
40 boost::lock_guard<boost::mutex> lock(m_mtx);
42 std::vector<AbstractConnectionPool*>::iterator it = std::find(m_pools.begin(), m_pools.end(), pool);
44 if(it != m_pools.end())
50 boost::lock_guard<boost::mutex> lock(m_mtx);
57 const std::size_t size = m_pools.size();
59 for(std::size_t i = 0; i < size; ++i)
60 m_pools[i]->initialize();
77 boost::lock_guard<boost::mutex> lock(m_mtx);
80 const std::size_t size = m_pools.size();
82 for(std::size_t i = 0; i < size; ++i)
83 m_pools[i]->finalize();
85 m_initialized =
false;
94 : m_initialized(false)
112 boost::lock_guard<boost::mutex> lock(getInstance().m_mtx);
114 std::vector<AbstractConnectionPool*>& pools = getInstance().m_pools;
116 const std::size_t size = pools.size();
118 for(std::size_t i = 0; i < size; ++i)
123 boost::this_thread::sleep(sleepTime);
126 catch(boost::thread_interrupted&)
A singleton for managing the connection pools available in the system.
ConnectionPoolManager()
Singleton constructor is protected.
std::vector< AbstractConnectionPool * > m_pools
The list of monitored pools.
This class defines the basic interface for a connection pool.
void add(AbstractConnectionPool *pool)
It adds the given pool to the list of monitored pools.
void monitore()
This static method encapsulates the execution thread that monitores all the pools.
#define TE_POOL_DEFAULT_MONITORING_TIME
This sets the default monitoring time in seconds for the connection pool manager. ...
This class defines the basic interface for a connection pool.
void remove(AbstractConnectionPool *pool)
It removes (un-register) the pool from the monitoring list.
~ConnectionPoolManager()
Singleton destructor is protected.
boost::mutex m_mtx
A mutex to lock the manager access.
void stop()
It stops the connection pools monitoring thread.
bool isInitialized() const
It returns true if the manager was already started.
void start()
It starts a new thread of execution that will monitore all the connection pools.