All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::da::ConnectionPoolManager Class Reference

A singleton for managing the connection pools available in the system. More...

#include <ConnectionPoolManager.h>

Inheritance diagram for te::da::ConnectionPoolManager:
te::common::Singleton< ConnectionPoolManager >

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 ConnectionPoolManagergetInstance ()
 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 >
 

Detailed Description

A singleton for managing the connection pools available in the system.

See also
AbstractConnectionPool

Definition at line 53 of file ConnectionPoolManager.h.

Constructor & Destructor Documentation

te::da::ConnectionPoolManager::ConnectionPoolManager ( )
protected

Singleton constructor is protected.

Definition at line 93 of file ConnectionPoolManager.cpp.

te::da::ConnectionPoolManager::~ConnectionPoolManager ( )
protected

Singleton destructor is protected.

Definition at line 98 of file ConnectionPoolManager.cpp.

Member Function Documentation

void te::da::ConnectionPoolManager::add ( AbstractConnectionPool pool)

It adds the given pool to the list of monitored pools.

Parameters
poolThe pool to be monitored.

Definition at line 30 of file ConnectionPoolManager.cpp.

References m_mtx, and m_pools.

static ConnectionPoolManager & te::common::Singleton< ConnectionPoolManager >::getInstance ( )
staticinherited

It returns a reference to the singleton instance.

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.

Returns
True if the manager was already started and are monitoring the pools.

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.

Note
This method will be excuted every x seconds.

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.

Parameters
poolThe 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().

Friends And Related Function Documentation

Definition at line 55 of file ConnectionPoolManager.h.

Member Data Documentation

bool te::da::ConnectionPoolManager::m_initialized
private

A flag that indicates if the manager is monitoring the pools.

Definition at line 108 of file ConnectionPoolManager.h.

boost::mutex te::da::ConnectionPoolManager::m_mtx
private

A mutex to lock the manager access.

Definition at line 106 of file ConnectionPoolManager.h.

Referenced by add().

std::vector<AbstractConnectionPool*> te::da::ConnectionPoolManager::m_pools
private

The list of monitored pools.

Definition at line 105 of file ConnectionPoolManager.h.

Referenced by add().

boost::thread te::da::ConnectionPoolManager::m_thread
private

The monitoring thread.

Definition at line 107 of file ConnectionPoolManager.h.


The documentation for this class was generated from the following files: