summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/SessionImpl.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-10-08 02:03:05 +0000
committerAlan Conway <aconway@apache.org>2008-10-08 02:03:05 +0000
commit8f38f773e173aa86d653996bc0b9d0abb160c846 (patch)
tree16aa42b4c310ae69989508c7030f6a6c0e1e19cb /cpp/src/qpid/client/SessionImpl.h
parent1896a5d32c87555877edd1dafc1bd34e3fcf5683 (diff)
downloadqpid-python-8f38f773e173aa86d653996bc0b9d0abb160c846.tar.gz
SessionImpl using ExceptionHolder to generate correctly typed exceptions..
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@702681 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/SessionImpl.h')
-rw-r--r--cpp/src/qpid/client/SessionImpl.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/cpp/src/qpid/client/SessionImpl.h b/cpp/src/qpid/client/SessionImpl.h
index 989294b99e..49a65ed568 100644
--- a/cpp/src/qpid/client/SessionImpl.h
+++ b/cpp/src/qpid/client/SessionImpl.h
@@ -27,6 +27,7 @@
#include "Results.h"
#include "qpid/SessionId.h"
+#include "qpid/SessionState.h"
#include "qpid/shared_ptr.h"
#include "qpid/framing/FrameHandler.h"
#include "qpid/framing/ChannelHandler.h"
@@ -35,6 +36,7 @@
#include "qpid/framing/AMQP_ServerProxy.h"
#include "qpid/sys/Semaphore.h"
#include "qpid/sys/StateMonitor.h"
+#include "qpid/sys/ExceptionHolder.h"
#include <boost/optional.hpp>
@@ -52,6 +54,7 @@ namespace client {
class Future;
class ConnectionImpl;
+class SessionHandler;
///@internal
class SessionImpl : public framing::FrameHandler::InOutHandler,
@@ -91,6 +94,8 @@ public:
void sendCompletion();
void sendFlush();
+ void setException(const sys::ExceptionHolder&);
+
//NOTE: these are called by the network thread when the connection is closed or dies
void connectionClosed(uint16_t code, const std::string& text);
void connectionBroke(uint16_t code, const std::string& text);
@@ -102,12 +107,6 @@ public:
uint32_t getTimeout() const;
private:
- enum ErrorType {
- OK,
- CONNECTION_CLOSE,
- SESSION_DETACH,
- EXCEPTION
- };
enum State {
INACTIVE,
ATTACHING,
@@ -123,6 +122,7 @@ private:
inline void setState(State s);
inline void waitFor(State);
+ void setExceptionLH(const sys::ExceptionHolder&); // LH = lock held when called.
void detach();
void check() const;
@@ -168,9 +168,7 @@ private:
const std::string& description,
const framing::FieldTable& errorInfo);
- ErrorType error;
- int code; // Error code
- std::string text; // Error text
+ sys::ExceptionHolder exceptionHolder;
mutable StateMonitor state;
mutable sys::Semaphore sendLock;
uint32_t detachedLifetime;
@@ -193,6 +191,9 @@ private:
framing::SequenceNumber nextIn;
framing::SequenceNumber nextOut;
+ SessionState sessionState;
+
+ friend class client::SessionHandler;
};
}} // namespace qpid::client