SessionPool diagnostics

This commit is contained in:
Alex Fabijanic
2014-02-10 21:33:38 -06:00
parent f993183637
commit 0ad18f3e80
4 changed files with 55 additions and 0 deletions

View File

@@ -174,6 +174,10 @@ public:
/// Returns the requested property.
void shutdown();
/// Shuts down the session pool.
bool isActive() const;
/// Returns true if session pool is active (not shut down).
protected:
typedef Poco::AutoPtr<PooledSessionHolder> PooledSessionHolderPtr;
@@ -233,6 +237,12 @@ inline std::string SessionPool::name() const
}
inline bool SessionPool::isActive() const
{
return !_shutdown;
}
} } // namespace Poco::Data

View File

@@ -74,6 +74,16 @@ public:
/// newly created pool. If pool already exists, request to add is silently
/// ignored and session is returned from the existing pool.
bool has(const std::string& name) const;
/// Returns true if the requested name exists, false otherwise.
bool isActive(const std::string& sessionKey,
const std::string& connectionString = "") const;
/// Returns true if the session is active (i.e. not shut down).
/// If connectionString is empty string, sessionKey must be a
/// fully qualified session name as registered with the pool
/// container.
Session get(const std::string& name);
/// Returns the requested Session.
/// Throws NotFoundException if session is not found.
@@ -102,6 +112,12 @@ private:
};
inline bool SessionPoolContainer::has(const std::string& name) const
{
return _sessionPools.find(name) != _sessionPools.end();
}
inline void SessionPoolContainer::remove(const std::string& name)
{
_sessionPools.erase(name);