te::da::AbstractConnectionPool Class Referenceabstract

This class defines the basic interface for a connection pool. More...

#include <AbstractConnectionPool.h>

Inheritance diagram for te::da::AbstractConnectionPool:
te::pgis::ConnectionPool

Public Member Functions

Pure Virtual Methods

Methods that subclasses must implement.

virtual void initialize ()=0
 It initializes the connections to be managed by the pool. More...
 
virtual void finalize ()=0
 It closes all connections and clears all resources managed by the pool. More...
 
virtual void idle ()=0
 It releases the connections that are not in use for a long time. More...
 
virtual bool isValid () const =0
 It checks if all the connections in the pool are valid (the communication channel is ok). More...
 
virtual bool isInitialized () const =0
 It returns true if the connection pool is initialized, otherwise it returns false. More...
 
virtual std::size_t getPoolSize () const =0
 It returns the number of connections in the pool. More...
 
virtual std::size_t getInitialPoolSize () const =0
 It returns the initial number of connections opened by the pool at its startup. More...
 
virtual void setInitialPoolSize (std::size_t size)=0
 It sets the initial number of connections opened by the pool at its startup. More...
 
virtual std::size_t getMinPoolSize () const =0
 It returns the minimum number of connections managed by the pool. More...
 
virtual void setMinPoolSize (std::size_t size)=0
 It sets the minimum number of connections managed by the pool. More...
 
virtual std::size_t getMaxPoolSize () const =0
 It returns the maximum number of connections managed by the pool. More...
 
virtual void setMaxPoolSize (std::size_t size)=0
 It sets the maximum number of connections managed by the pool. More...
 

Protected Member Functions

 AbstractConnectionPool ()
 Default constructor. More...
 
virtual ~AbstractConnectionPool ()
 Virtual destructor. More...
 

Detailed Description

This class defines the basic interface for a connection pool.

A connection pool keeps a cache of physical connections to a data source. These connections can be reused by the application when it receives new requests for a connection.

A connection pool is a way to improve performance and scalability when multiple clients can share a smaller number of physical database connections. It manages a set of connections to be used by the applications. In TerraLib, each data source can have its own connection pool.

This class takes part of the data source connection framework and it is optionally used in a data source driver implementation.

Notice that a given data source object can have its own connection pool. So each data source can control the number of simultaneous opened connections.

See also
ConnectionPoolManager

Definition at line 64 of file AbstractConnectionPool.h.

Constructor & Destructor Documentation

te::da::AbstractConnectionPool::AbstractConnectionPool ( )
inlineprotected

Default constructor.

Definition at line 200 of file AbstractConnectionPool.h.

virtual te::da::AbstractConnectionPool::~AbstractConnectionPool ( )
inlineprotectedvirtual

Virtual destructor.

Definition at line 203 of file AbstractConnectionPool.h.

Member Function Documentation

virtual void te::da::AbstractConnectionPool::finalize ( )
pure virtual

It closes all connections and clears all resources managed by the pool.

Exceptions
ExceptionIt may throws an exception if there is a connection in use or if it is not possible to stop the pool.
Note
Successive calls won't have effect.
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual std::size_t te::da::AbstractConnectionPool::getInitialPoolSize ( ) const
pure virtual

It returns the initial number of connections opened by the pool at its startup.

Returns
The initial number of connections opened by the pool at its startup.
Note
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual std::size_t te::da::AbstractConnectionPool::getMaxPoolSize ( ) const
pure virtual

It returns the maximum number of connections managed by the pool.

Returns
The maximum number of connections managed by the pool.
Note
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual std::size_t te::da::AbstractConnectionPool::getMinPoolSize ( ) const
pure virtual

It returns the minimum number of connections managed by the pool.

Returns
The minimum number of connections managed by the pool.
Note
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual std::size_t te::da::AbstractConnectionPool::getPoolSize ( ) const
pure virtual

It returns the number of connections in the pool.

Returns
The number of the connections in the pool.
Note
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual void te::da::AbstractConnectionPool::idle ( )
pure virtual

It releases the connections that are not in use for a long time.

This method will try to keep the pool with the minimum number of opened connections. It will be invoked by the connection pool manager when its thread wakeup. It must check the idle connections and must destroy them.

Note
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual void te::da::AbstractConnectionPool::initialize ( )
pure virtual

It initializes the connections to be managed by the pool.

Exceptions
ExceptionIt throws an exception if it is not possible to initialize the pool.
Note
Successive calls won't have effect.
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual bool te::da::AbstractConnectionPool::isInitialized ( ) const
pure virtual

It returns true if the connection pool is initialized, otherwise it returns false.

Returns
True if the connection pool is initialized, otherwise it returns false.
Note
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual bool te::da::AbstractConnectionPool::isValid ( ) const
pure virtual

It checks if all the connections in the pool are valid (the communication channel is ok).

Returns
It returns true if all the connections are valid (the communication channel is ok), otherwise it returns false.
Note
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual void te::da::AbstractConnectionPool::setInitialPoolSize ( std::size_t  size)
pure virtual

It sets the initial number of connections opened by the pool at its startup.

Parameters
sizeIt specifies the initial number of connections that must be opened by the pool at its startup.
Note
The pool must be reset before the changes take effect.
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual void te::da::AbstractConnectionPool::setMaxPoolSize ( std::size_t  size)
pure virtual

It sets the maximum number of connections managed by the pool.

Parameters
sizeThe maximum number of connections that the pool must manage.
Note
The pool must be reset before the changes take effect.
Thread-safe.

Implemented in te::pgis::ConnectionPool.

virtual void te::da::AbstractConnectionPool::setMinPoolSize ( std::size_t  size)
pure virtual

It sets the minimum number of connections managed by the pool.

Parameters
sizeThe minimum number of connections that the pool must manage.
Note
The pool must be reset before the changes take effect.
Thread-safe.

Implemented in te::pgis::ConnectionPool.


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