// OConnectionPool - the one-instance service for PooledConnections // manages the active connections and the connections in the pool
// typedef for the internal structure typedef std::vector< css::uno::Reference< css::sdbc::XPooledConnection> > TPooledConnections;
// contains the currently pooled connections struct TConnectionPool
{
TPooledConnections aConnections;
sal_Int32 nALiveCount; // will be decremented every time a time says to, when will reach zero the pool will be deleted
};
// contains additional information about an activeconnection which is needed to put it back to the pool struct TActiveConnectionInfo
{
TConnectionMap::iterator aPos;
css::uno::Reference< css::sdbc::XPooledConnection> xPooledConnection;
};
class OConnectionPool : public ::cppu::WeakImplHelper< css::beans::XPropertyChangeListener>
{
TConnectionMap m_aPool; // the pooled connections
TActiveConnectionMap m_aActiveConnections; // the currently active connections
std::mutex m_aMutex;
::rtl::Reference<OPoolTimer> m_xInvalidator; // invalidates the connection pool when shot
css::uno::Reference< css::sdbc::XDriver > m_xDriver; // the one and only driver for this connectionpool
css::uno::Reference< css::uno::XInterface > m_xDriverNode; // config node entry
css::uno::Reference< css::reflection::XProxyFactory > m_xProxyFactory;
sal_Int32 m_nTimeOut;
sal_Int32 m_nALiveCount;
private:
css::uno::Reference< css::sdbc::XConnection> createNewConnection(const OUString& _rURL, const css::uno::Sequence< css::beans::PropertyValue >& _rInfo);
css::uno::Reference< css::sdbc::XConnection> getPooledConnection(TConnectionMap::iterator const & _rIter); // calculate the timeout and the corresponding ALiveCount void calculateTimeOuts();
protected: // the dtor will be called from the last instance (last release call) virtual ~OConnectionPool() override; public:
OConnectionPool(const css::uno::Reference< css::sdbc::XDriver >& _xDriver, const css::uno::Reference< css::uno::XInterface >& _xDriverNode, const css::uno::Reference< css::reflection::XProxyFactory >& _rxProxyFactory);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.