Poco::Data

class SessionPoolContainer

Library: Data
Package: SessionPooling
Header: Poco/Data/SessionPoolContainer.h

Description

This class implements container of session pools.

Member Summary

Member Functions: add, count, get, getPool, has, isActive, remove, shutdown

Constructors

SessionPoolContainer

SessionPoolContainer();

Creates the SessionPoolContainer for sessions with the given session parameters.

Destructor

~SessionPoolContainer

~SessionPoolContainer();

Destroys the SessionPoolContainer.

Member Functions

add

void add(
    SessionPool * pPool
);

Adds existing session pool to the container. Throws SessionPoolExistsException if pool already exists.

add

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.

count inline

int count() const;

Returns the number of session pols in the container.

get

Session get(
    const std::string & name
);

Returns the requested Session. Throws NotFoundException if session is not found.

getPool

SessionPool & getPool(
    const std::string & name
);

Returns a SessionPool reference. Throws NotFoundException if session is not found.

has inline

bool has(
    const std::string & name
) const;

Returns true if the requested name exists, false otherwise.

isActive

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.

remove inline

void remove(
    const std::string & name
);

Removes a SessionPool.

shutdown

void shutdown();

Shuts down all the held pools.