activemq-cpp-3.9.5
SessionPool.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _ACTIVEMQ_CMSUTIL_SESSIONPOOL_H_
19#define _ACTIVEMQ_CMSUTIL_SESSIONPOOL_H_
20
23#include <cms/Connection.h>
24#include <list>
26
27namespace activemq {
28namespace cmsutil {
29
30 // Forward declarations.
32
39 class AMQCPP_API SessionPool {
40 private:
41
42 cms::Connection* connection;
43
44 ResourceLifecycleManager* resourceLifecycleManager;
45
47
48 std::list<PooledSession*> available;
49
50 std::list<PooledSession*> sessions;
51
52 cms::Session::AcknowledgeMode acknowledgeMode;
53
54 private:
55
56 SessionPool(const SessionPool&);
57 SessionPool& operator=(const SessionPool&);
58
59 public:
60
73 ResourceLifecycleManager* resourceLifecycleManager);
74
79 virtual ~SessionPool();
80
89
96 virtual void returnSession(PooledSession* session);
97
99 return resourceLifecycleManager;
100 }
101
102 };
103
104}}
105
106#endif /*_ACTIVEMQ_CMSUTIL_SESSIONPOOL_H_*/
#define AMQCPP_API
Definition Config.h:30
A pooled session object that wraps around a delegate session.
Definition PooledSession.h:37
Manages the lifecycle of a set of CMS resources.
Definition ResourceLifecycleManager.h:37
virtual ~SessionPool()
Destroys the pooled session objects, but not the underlying session resources.
virtual PooledSession * takeSession()
Takes a session from the pool, creating one if necessary.
virtual void returnSession(PooledSession *session)
Returns a session to the pool.
SessionPool(cms::Connection *connection, cms::Session::AcknowledgeMode ackMode, ResourceLifecycleManager *resourceLifecycleManager)
Constructs a session pool.
ResourceLifecycleManager * getResourceLifecycleManager()
Definition SessionPool.h:98
The client's connection to its provider.
Definition Connection.h:70
AcknowledgeMode
Definition Session.h:108
Mutex object that offers recursive support on all platforms as well as providing the ability to use t...
Definition Mutex.h:39
Definition CachedConsumer.h:25
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24