re-added customizeSession() method from 1.4.x releases

This commit is contained in:
Guenter Obiltschnig 2015-11-02 10:21:07 +01:00
parent 64ed9bacf0
commit 8fd28947b9
2 changed files with 12 additions and 0 deletions

View File

@ -160,6 +160,12 @@ public:
/// Returns true if session pool is active (not shut down).
protected:
virtual void customizeSession(Session& session);
/// Can be overridden by subclass to perform custom initialization
/// of a newly created database session.
///
/// The default implementation does nothing.
typedef Poco::AutoPtr<PooledSessionHolder> PooledSessionHolderPtr;
typedef Poco::AutoPtr<PooledSessionImpl> PooledSessionImplPtr;
typedef std::list<PooledSessionHolderPtr> SessionList;

View File

@ -76,6 +76,7 @@ Session SessionPool::get()
{
Session newSession(SessionFactory::instance().create(_connector, _connectionString));
applySettings(newSession.impl());
customizeSession(newSession);
PooledSessionHolderPtr pHolder(new PooledSessionHolder(*this, newSession.impl()));
_idleSessions.push_front(pHolder);
@ -221,6 +222,11 @@ void SessionPool::applySettings(SessionImpl* pImpl)
}
void SessionPool::customizeSession(Session&)
{
}
void SessionPool::putBack(PooledSessionHolderPtr pHolder)
{
Poco::Mutex::ScopedLock lock(_mutex);