Wt  3.3.6
Public Member Functions | List of all members
Wt::Dbo::FixedSqlConnectionPool Class Reference

A connection pool of fixed size. More...

#include <Wt/Dbo/FixedSqlConnectionPool>

Inheritance diagram for Wt::Dbo::FixedSqlConnectionPool:
Inheritance graph
[legend]

Public Member Functions

 FixedSqlConnectionPool (SqlConnection *connection, int size)
 Creates a fixed connection pool. More...
 
virtual SqlConnectiongetConnection ()
 Uses a connection from the pool. More...
 
virtual void returnConnection (SqlConnection *)
 Returns a connection to the pool. More...
 
virtual void prepareForDropTables () const
 Prepares all connections in the pool for dropping the tables.
 
- Public Member Functions inherited from Wt::Dbo::SqlConnectionPool
virtual ~SqlConnectionPool ()
 Destructor.
 

Detailed Description

A connection pool of fixed size.

This provides a connection pool of fixed size: its size is determined at startup time, and the pool will not grow as more connections are needed.

This is adequate when the number of threads (which need different connections to work with) is also bounded, like when using a fixed size thread pool. This is for example the case when used in conjunction with Wt. Note that you do not need as many connections as sessions, since Session will only use a connection while processing a transaction.

Constructor & Destructor Documentation

Wt::Dbo::FixedSqlConnectionPool::FixedSqlConnectionPool ( SqlConnection connection,
int  size 
)

Creates a fixed connection pool.

The pool is initialized with the provided connection, which is cloned (size - 1) times.

The pool thus takes ownership of the given connection.

Member Function Documentation

SqlConnection * Wt::Dbo::FixedSqlConnectionPool::getConnection ( )
virtual

Uses a connection from the pool.

This returns a connection from the pool that can be used. If the pool has no more connection available, the pool may decide to grow or block until a connection is returned.

This method is called by a Session when a new transaction is started.

Implements Wt::Dbo::SqlConnectionPool.

void Wt::Dbo::FixedSqlConnectionPool::returnConnection ( SqlConnection )
virtual

Returns a connection to the pool.

This returns a connection to the pool. This method is called by a Session after a transaction has been finished.

Implements Wt::Dbo::SqlConnectionPool.


Generated on Mon Aug 8 2016 for the C++ Web Toolkit (Wt) by doxygen 1.8.11