diff options
Diffstat (limited to 'cpp/demo/Ice/session/SessionI.cpp')
-rwxr-xr-x | cpp/demo/Ice/session/SessionI.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/cpp/demo/Ice/session/SessionI.cpp b/cpp/demo/Ice/session/SessionI.cpp index e3dc2c4937d..4cf07aa8fa3 100755 --- a/cpp/demo/Ice/session/SessionI.cpp +++ b/cpp/demo/Ice/session/SessionI.cpp @@ -9,6 +9,7 @@ #include <Ice/Ice.h> #include <SessionFactoryI.h> +#include <SessionI.h> using namespace std; using namespace Demo; @@ -42,7 +43,11 @@ HelloPrx SessionI::createHello(const Ice::Current& c) { Lock sync(*this); - // XXX Check for destruction missing. + if(_destroy) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + HelloPrx hello = HelloPrx::uncheckedCast(c.adapter->addWithUUID(new HelloI(_nextId++))); _objs.push_back(hello); return hello; @@ -52,7 +57,11 @@ void SessionI::refresh(const Ice::Current& c) { Lock sync(*this); - // XXX Check for destruction missing. + if(_destroy) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + _timestamp = IceUtil::Time::now(); } @@ -60,7 +69,11 @@ void SessionI::destroy(const Ice::Current& c) { Lock sync(*this); - // XXX Check for destruction missing. + if(_destroy) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + _destroy = true; cout << "The session #" << Ice::identityToString(c.id) << " is now destroyed." << endl; |