activemq-cpp-3.4.0

activemq::cmsutil::SessionPool Class Reference

A pool of CMS sessions from the same connection and with the same acknowledge mode. More...

#include <src/main/activemq/cmsutil/SessionPool.h>

Public Member Functions

 SessionPool (cms::Connection *connection, cms::Session::AcknowledgeMode ackMode, ResourceLifecycleManager *resourceLifecycleManager)
 Constructs a session pool.
virtual ~SessionPool ()
 Destroys the pooled session objects, but not the underlying session resources.
virtual PooledSessiontakeSession ()
 Takes a session from the pool, creating one if necessary.
virtual void returnSession (PooledSession *session)
 Returns a session to the pool.
ResourceLifecycleManagergetResourceLifecycleManager ()

Detailed Description

A pool of CMS sessions from the same connection and with the same acknowledge mode.

Internal session resources are managed through a provided ResourceLifecycleManager, not by this pool. This class is thread-safe.


Constructor & Destructor Documentation

activemq::cmsutil::SessionPool::SessionPool ( cms::Connection connection,
cms::Session::AcknowledgeMode  ackMode,
ResourceLifecycleManager resourceLifecycleManager 
)

Constructs a session pool.

Parameters:
connectionthe connection to be used for creating all sessions.
ackModethe acknowledge mode to be used for all sessions
resourceLifecycleManagerthe object responsible for managing the lifecycle of any allocated cms::Session resources.
virtual activemq::cmsutil::SessionPool::~SessionPool ( ) [virtual]

Destroys the pooled session objects, but not the underlying session resources.

That is the job of the ResourceLifecycleManager.


Member Function Documentation

ResourceLifecycleManager* activemq::cmsutil::SessionPool::getResourceLifecycleManager ( ) [inline]
virtual void activemq::cmsutil::SessionPool::returnSession ( PooledSession session) [virtual]

Returns a session to the pool.

Parameters:
sessionthe session to be returned.
virtual PooledSession* activemq::cmsutil::SessionPool::takeSession ( ) [virtual]

Takes a session from the pool, creating one if necessary.

Returns:
the pooled session object
Exceptions:
CMSExceptionif an error occurred

The documentation for this class was generated from the following file: