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&)
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.
void remove(AbstractConnectionPool *pool)
It removes (un-register) the pool from the monitoring list.
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.
This class defines the basic interface for a connection pool.
#define TERRALIB_POOL_DEFAULT_MONITORING_TIME
This sets the default monitoring time in seconds for the connection pool manager. ...
boost::mutex m_mtx
A mutex to lock the manager access.
This class defines the basic interface for a connection pool.
A singleton for managing the connection pools available in the system.
bool isInitialized() const
It returns true if the manager was already started.