summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/SessionManager.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-09-24 21:15:46 +0000
committerAlan Conway <aconway@apache.org>2007-09-24 21:15:46 +0000
commitb3992a21f76f38797723f70168ecda6be21e3719 (patch)
tree9654292603c8b2bc31d5685e8f965b4713352f72 /cpp/src/qpid/broker/SessionManager.h
parent96c24e0cd7359cfb2fb026c742cbd1b2d23a0015 (diff)
downloadqpid-python-b3992a21f76f38797723f70168ecda6be21e3719.tar.gz
2007-09-24 Alan Conway <aconway@redhat.com>
* cpp/src/qpid/broker/SessionManager.cpp: Manage suspended sessions. Replaces SuspendedSessions. * cpp/src/qpid/broker/SessionState.cpp: Work with SessionManager. * cpp/src/qpid/broker/SessionHandler.cpp: Owns SessionState. * cpp/src/qpid/broker/Connection.h, .cpp: Owns session handlers. * cpp/src/qpid/broker/Broker.h: Added SessionManager member. * cpp/src/Makefile.am: Added broker/SessionManager.cpp * amqp.0-10-preview.xml: Added session-busy and channel-busy constants. * cpp/src/tests/.valgrind.supp-default: Added suppresssions for F7. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@578975 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/SessionManager.h')
-rw-r--r--cpp/src/qpid/broker/SessionManager.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/cpp/src/qpid/broker/SessionManager.h b/cpp/src/qpid/broker/SessionManager.h
new file mode 100644
index 0000000000..8225f04798
--- /dev/null
+++ b/cpp/src/qpid/broker/SessionManager.h
@@ -0,0 +1,83 @@
+#ifndef QPID_BROKER_SESSIONMANAGER_H
+#define QPID_BROKER_SESSIONMANAGER_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qpid/framing/Uuid.h>
+#include <qpid/sys/Time.h>
+#include <qpid/sys/Mutex.h>
+
+#include <boost/noncopyable.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+#include <set>
+#include <vector>
+#include <memory>
+
+namespace qpid {
+namespace broker {
+
+class SessionState;
+class SessionHandler;
+
+/**
+ * Create and manage SessionState objects.
+ */
+class SessionManager : private boost::noncopyable {
+ public:
+ SessionManager();
+ ~SessionManager();
+ /** Open a new active session, caller takes ownership */
+ std::auto_ptr<SessionState> open(
+ SessionHandler& h, uint32_t timeout_);
+
+ /** Suspend a session, start it's timeout counter.
+ * The factory takes ownership.
+ */
+ void suspend(std::auto_ptr<SessionState> session);
+
+ /** Resume a suspended session.
+ *@throw Exception if timed out or non-existant.
+ */
+ std::auto_ptr<SessionState> resume(const framing::Uuid& id);
+
+ private:
+ typedef boost::ptr_vector<SessionState> Suspended;
+ typedef std::set<framing::Uuid> Active;
+
+ sys::Mutex lock;
+ Suspended suspended;
+ Active active;
+
+ void eraseExpired();
+ friend class SessionState; // removes deleted sessions from active set.
+};
+
+
+
+}} // namespace qpid::broker
+
+
+
+
+
+#endif /*!QPID_BROKER_SESSIONMANAGER_H*/