diff options
author | Marc Laukien <marc@zeroc.com> | 2005-04-18 19:19:50 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2005-04-18 19:19:50 +0000 |
commit | 7f2013b080d5338788747ca03e4edf07063e06ce (patch) | |
tree | c1be882de712c9ebffe3788d1ff6c207d4f3a39a /cpp/demo/Ice/session/SessionI.cpp | |
parent | comments (diff) | |
download | ice-7f2013b080d5338788747ca03e4edf07063e06ce.tar.bz2 ice-7f2013b080d5338788747ca03e4edf07063e06ce.tar.xz ice-7f2013b080d5338788747ca03e4edf07063e06ce.zip |
comments
Diffstat (limited to 'cpp/demo/Ice/session/SessionI.cpp')
-rwxr-xr-x | cpp/demo/Ice/session/SessionI.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cpp/demo/Ice/session/SessionI.cpp b/cpp/demo/Ice/session/SessionI.cpp index ec4ffc296ef..75569accf48 100755 --- a/cpp/demo/Ice/session/SessionI.cpp +++ b/cpp/demo/Ice/session/SessionI.cpp @@ -13,6 +13,8 @@ using namespace std; using namespace Demo; +// XXX Add using namespace Ice. + class HelloI : public Hello { public: @@ -24,6 +26,8 @@ public: ~HelloI() { + // XXX Use real output, something like "`Hello' object #xxx + // destroyed.", not programming language style output. cout << _id << ": ~Hello" << endl; } @@ -49,6 +53,7 @@ SessionI::SessionI(const Ice::ObjectAdapterPtr& adapter, const IceUtil::Time& ti SessionI::~SessionI() { + // XXX Remove, or add user-readable comment. cout << "~SessionI" << endl; } @@ -56,6 +61,7 @@ HelloPrx SessionI::createHello(const Ice::Current&) { Lock sync(*this); + // XXX Check for destruction w/ ObjectNotExistException? HelloPrx hello = HelloPrx::uncheckedCast(_adapter->addWithUUID(new HelloI(_nextId++))); _objs.push_back(hello); return hello; @@ -65,6 +71,7 @@ void SessionI::refresh(const Ice::Current& c) { Lock sync(*this); + // XXX Check for destruction w/ ObjectNotExistException? _refreshTime = IceUtil::Time::now(); } @@ -72,20 +79,27 @@ void SessionI::destroy(const Ice::Current& c) { Lock sync(*this); + // XXX Check for destruction w/ ObjectNotExistException? _destroy = true; + // XXX Add cleanup from the so-called "destroyCallback" here. } bool SessionI::destroyed() const { + // XXX This should only check for _destroy. A reaper thread should + // call destroy() if there was a timeout. Lock sync(*this); return _destroy || (IceUtil::Time::now() - _refreshTime) > _timeout; } +// XXX Get rid of this function, remove the hello objects from the +// object adapter in destroy(). void SessionI::destroyCallback() { Lock sync(*this); + // XXX Real output please, that is appropriate for a demo. cout << "SessionI::destroyCallback: _destroy=" << _destroy << " timeout=" << ((IceUtil::Time::now()-_refreshTime) > _timeout) << endl; for(list<HelloPrx>::const_iterator p = _objs.begin(); p != _objs.end(); ++p) |