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);
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)
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)
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&)
void start()
It starts a new thread of execution that will monitore all the connection pools.
void monitore()
This static method encapsulates the execution thread that monitores all the pools.
bool m_initialized
A flag that indicates if the manager is monitoring the pools.
static ConnectionPoolManager & getInstance()
It returns a reference to the singleton instance.
void remove(AbstractConnectionPool *pool)
It removes (un-register) the pool from the monitoring list.
boost::thread m_thread
The monitoring thread.
std::vector< AbstractConnectionPool * > m_pools
The list of monitored pools.
void add(AbstractConnectionPool *pool)
It adds the given pool to the list of monitored pools.
void stop()
It stops the connection pools monitoring thread.
ConnectionPoolManager()
Singleton constructor is protected.
~ConnectionPoolManager()
Singleton destructor is protected.
#define TERRALIB_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.
boost::mutex m_mtx
A mutex to lock the manager access.
This class defines the basic interface for a connection pool.
bool isInitialized() const
It returns true if the manager was already started.