mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 19:51:58 +01:00
SessionPool diagnostics
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user