activemq-cpp-3.8.2
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>
25 #include <activemq/util/Config.h>
26 
27 namespace activemq {
28 namespace cmsutil {
29 
30  // Forward declarations.
31  class ResourceLifecycleManager;
32 
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 
71  SessionPool(cms::Connection* connection,
73  ResourceLifecycleManager* resourceLifecycleManager);
74 
79  virtual ~SessionPool();
80 
88  virtual PooledSession* takeSession();
89 
96  virtual void returnSession(PooledSession* session);
97 
99  return resourceLifecycleManager;
100  }
101 
102  };
103 
104 }}
105 
106 #endif /*_ACTIVEMQ_CMSUTIL_SESSIONPOOL_H_*/
Mutex object that offers recursive support on all platforms as well as providing the ability to use t...
Definition: Mutex.h:39
#define AMQCPP_API
Definition: Config.h:30
AcknowledgeMode
Definition: Session.h:108
The client&#39;s connection to its provider.
Definition: Connection.h:70
A pool of CMS sessions from the same connection and with the same acknowledge mode.
Definition: SessionPool.h:39
Manages the lifecycle of a set of CMS resources.
Definition: ResourceLifecycleManager.h:37
ResourceLifecycleManager * getResourceLifecycleManager()
Definition: SessionPool.h:98
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
A pooled session object that wraps around a delegate session.
Definition: PooledSession.h:37