This class defines the basic interface for a connection pool. More...
#include <AbstractConnectionPool.h>
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... | |
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.
Definition at line 64 of file AbstractConnectionPool.h.
|
inlineprotected |
Default constructor.
Definition at line 200 of file AbstractConnectionPool.h.
|
inlineprotectedvirtual |
Virtual destructor.
Definition at line 203 of file AbstractConnectionPool.h.
|
pure virtual |
It closes all connections and clears all resources managed by the pool.
Exception | It may throws an exception if there is a connection in use or if it is not possible to stop the pool. |
Implemented in te::pgis::ConnectionPool.
|
pure virtual |
It returns the initial number of connections opened by the pool at its startup.
Implemented in te::pgis::ConnectionPool.
|
pure virtual |
It returns the maximum number of connections managed by the pool.
Implemented in te::pgis::ConnectionPool.
|
pure virtual |
It returns the minimum number of connections managed by the pool.
Implemented in te::pgis::ConnectionPool.
|
pure virtual |
It returns the number of connections in the pool.
Implemented in te::pgis::ConnectionPool.
|
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.
Implemented in te::pgis::ConnectionPool.
|
pure virtual |
It initializes the connections to be managed by the pool.
Exception | It throws an exception if it is not possible to initialize the pool. |
Implemented in te::pgis::ConnectionPool.
|
pure virtual |
It returns true if the connection pool is initialized, otherwise it returns false.
Implemented in te::pgis::ConnectionPool.
|
pure virtual |
It checks if all the connections in the pool are valid (the communication channel is ok).
Implemented in te::pgis::ConnectionPool.
|
pure virtual |
It sets the initial number of connections opened by the pool at its startup.
size | It specifies the initial number of connections that must be opened by the pool at its startup. |
Implemented in te::pgis::ConnectionPool.
|
pure virtual |
It sets the maximum number of connections managed by the pool.
size | The maximum number of connections that the pool must manage. |
Implemented in te::pgis::ConnectionPool.
|
pure virtual |
It sets the minimum number of connections managed by the pool.
size | The minimum number of connections that the pool must manage. |
Implemented in te::pgis::ConnectionPool.