00001 #ifndef QPID_BROKER_SESSIONMANAGER_H
00002 #define QPID_BROKER_SESSIONMANAGER_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <qpid/SessionState.h>
00026 #include <qpid/sys/Time.h>
00027 #include <qpid/sys/Mutex.h>
00028 #include <qpid/RefCounted.h>
00029
00030 #include <set>
00031 #include <vector>
00032 #include <memory>
00033
00034 #include <boost/noncopyable.hpp>
00035 #include <boost/ptr_container/ptr_vector.hpp>
00036 #include <boost/intrusive_ptr.hpp>
00037
00038 namespace qpid {
00039 namespace broker {
00040 class Broker;
00041 class SessionState;
00042 class SessionHandler;
00043
00047 class SessionManager : private boost::noncopyable {
00048 public:
00049 SessionManager(const qpid::SessionState::Configuration&, Broker&);
00050
00051 ~SessionManager();
00052
00054 std::auto_ptr<SessionState> attach(SessionHandler& h, const SessionId& id, bool);
00055
00057 void detach(std::auto_ptr<SessionState>);
00058
00060 void forget(const SessionId&);
00061
00062 Broker& getBroker() const { return broker; }
00063
00064 const qpid::SessionState::Configuration& getSessionConfig() const { return config; }
00065
00066 private:
00067 typedef boost::ptr_vector<SessionState> Detached;
00068 typedef std::set<SessionId> Attached;
00069
00070 void eraseExpired();
00071
00072 sys::Mutex lock;
00073 Detached detached;
00074 Attached attached;
00075 qpid::SessionState::Configuration config;
00076 Broker& broker;
00077 };
00078
00079
00080
00081 }}
00082
00083
00084
00085
00086
00087 #endif