A singleton for managing the connection pools available in the system. More...
#include <ConnectionPoolManager.h>
Public Member Functions | |
void | add (AbstractConnectionPool *pool) |
It adds the given pool to the list of monitored pools. More... | |
bool | isInitialized () const |
It returns true if the manager was already started. More... | |
void | monitore () |
This static method encapsulates the execution thread that monitores all the pools. More... | |
void | remove (AbstractConnectionPool *pool) |
It removes (un-register) the pool from the monitoring list. More... | |
void | start () |
It starts a new thread of execution that will monitore all the connection pools. More... | |
void | stop () |
It stops the connection pools monitoring thread. More... | |
Static Public Member Functions | |
static ConnectionPoolManager & | getInstance () |
It returns a reference to the singleton instance. More... | |
Protected Member Functions | |
ConnectionPoolManager () | |
Singleton constructor is protected. More... | |
~ConnectionPoolManager () | |
Singleton destructor is protected. More... | |
Private Attributes | |
bool | m_initialized |
A flag that indicates if the manager is monitoring the pools. More... | |
boost::mutex | m_mtx |
A mutex to lock the manager access. More... | |
std::vector < AbstractConnectionPool * > | m_pools |
The list of monitored pools. More... | |
boost::thread | m_thread |
The monitoring thread. More... | |
Friends | |
class | te::common::Singleton< ConnectionPoolManager > |
A singleton for managing the connection pools available in the system.
Definition at line 53 of file ConnectionPoolManager.h.
|
protected |
Singleton constructor is protected.
Definition at line 93 of file ConnectionPoolManager.cpp.
|
protected |
Singleton destructor is protected.
Definition at line 98 of file ConnectionPoolManager.cpp.
void te::da::ConnectionPoolManager::add | ( | AbstractConnectionPool * | pool | ) |
It adds the given pool to the list of monitored pools.
pool | The pool to be monitored. |
Definition at line 30 of file ConnectionPoolManager.cpp.
|
staticinherited |
It returns a reference to the singleton instance.
Referenced by te::pgis::ConnectionPool::ConnectionPool(), te::da::Module::finalize(), te::da::Module::initialize(), te::da::Module::Module(), and te::pgis::ConnectionPool::~ConnectionPool().
bool te::da::ConnectionPoolManager::isInitialized | ( | ) | const |
It returns true if the manager was already started.
Definition at line 88 of file ConnectionPoolManager.cpp.
void te::da::ConnectionPoolManager::monitore | ( | ) |
This static method encapsulates the execution thread that monitores all the pools.
Definition at line 104 of file ConnectionPoolManager.cpp.
References TERRALIB_POOL_DEFAULT_MONITORING_TIME.
Referenced by start().
void te::da::ConnectionPoolManager::remove | ( | AbstractConnectionPool * | pool | ) |
It removes (un-register) the pool from the monitoring list.
pool | The pool to be removed from the monitoring list. |
Definition at line 38 of file ConnectionPoolManager.cpp.
void te::da::ConnectionPoolManager::start | ( | ) |
It starts a new thread of execution that will monitore all the connection pools.
Definition at line 48 of file ConnectionPoolManager.cpp.
References monitore().
Referenced by te::da::Module::initialize().
void te::da::ConnectionPoolManager::stop | ( | ) |
It stops the connection pools monitoring thread.
Definition at line 70 of file ConnectionPoolManager.cpp.
Referenced by te::da::Module::finalize().
|
friend |
Definition at line 55 of file ConnectionPoolManager.h.
|
private |
A flag that indicates if the manager is monitoring the pools.
Definition at line 108 of file ConnectionPoolManager.h.
|
private |
A mutex to lock the manager access.
Definition at line 106 of file ConnectionPoolManager.h.
Referenced by add().
|
private |
The list of monitored pools.
Definition at line 105 of file ConnectionPoolManager.h.
Referenced by add().
|
private |
The monitoring thread.
Definition at line 107 of file ConnectionPoolManager.h.