/usr/include/Poco/Data/SessionPoolContainer.h is in libpoco-dev 1.8.0.1-1ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | //
// SessionPoolContainer.h
//
// Library: Data
// Package: SessionPooling
// Module: SessionPoolContainer
//
// Definition of the SessionPoolContainer class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Data_SessionPoolContainer_INCLUDED
#define Data_SessionPoolContainer_INCLUDED
#include "Poco/Data/Data.h"
#include "Poco/Data/Session.h"
#include "Poco/Data/SessionPool.h"
#include "Poco/String.h"
#include "Poco/Mutex.h"
namespace Poco {
namespace Data {
class Data_API SessionPoolContainer
/// This class implements container of session pools.
{
public:
SessionPoolContainer();
/// Creates the SessionPoolContainer for sessions with the given session parameters.
~SessionPoolContainer();
/// Destroys the SessionPoolContainer.
void add(SessionPool* pPool);
/// Adds existing session pool to the container.
/// Throws SessionPoolExistsException if pool already exists.
Session add(const std::string& sessionKey,
const std::string& connectionString,
int minSessions = 1,
int maxSessions = 32,
int idleTime = 60);
/// Adds a new session pool to the container and returns a Session from
/// 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.
SessionPool& getPool(const std::string& name);
/// Returns a SessionPool reference.
/// Throws NotFoundException if session is not found.
void remove(const std::string& name);
/// Removes a SessionPool.
int count() const;
/// Returns the number of session pols in the container.
void shutdown();
/// Shuts down all the held pools.
private:
typedef std::map<std::string, AutoPtr<SessionPool>, Poco::CILess> SessionPoolMap;
SessionPoolContainer(const SessionPoolContainer&);
SessionPoolContainer& operator = (const SessionPoolContainer&);
SessionPoolMap _sessionPools;
Poco::FastMutex _mutex;
};
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);
}
inline int SessionPoolContainer::count() const
{
return static_cast<int>(_sessionPools.size());
}
} } // namespace Poco::Data
#endif // Data_SessionPoolContainer_INCLUDED
|