summaryrefslogtreecommitdiff
path: root/cpp/demo/Ice/session/ReapTask.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2015-03-18 12:58:16 -0230
committerMatthew Newhook <matthew@zeroc.com>2015-03-18 12:58:16 -0230
commit9b7668c7c92cf9cb311fe444cdddb489cd2a219d (patch)
tree5016567c58c81f5654e9d01935e199c6bf4761d2 /cpp/demo/Ice/session/ReapTask.cpp
parentVS add-in & build updates: (diff)
downloadice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.tar.bz2
ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.tar.xz
ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.zip
Removed demos.
Moved demoscript to distribution.
Diffstat (limited to 'cpp/demo/Ice/session/ReapTask.cpp')
-rw-r--r--cpp/demo/Ice/session/ReapTask.cpp59
1 files changed, 0 insertions, 59 deletions
diff --git a/cpp/demo/Ice/session/ReapTask.cpp b/cpp/demo/Ice/session/ReapTask.cpp
deleted file mode 100644
index 44c84d2c51e..00000000000
--- a/cpp/demo/Ice/session/ReapTask.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#include <ReapTask.h>
-
-using namespace std;
-using namespace Demo;
-
-ReapTask::ReapTask() :
- _timeout(IceUtil::Time::seconds(10))
-{
-}
-
-void
-ReapTask::runTimerTask()
-{
- Lock sync(*this);
-
- list<SessionProxyPair>::iterator p = _sessions.begin();
- while(p != _sessions.end())
- {
- try
- {
- //
- // Session destruction may take time in a
- // real-world example. Therefore the current time
- // is computed for each iteration.
- //
- if((IceUtil::Time::now(IceUtil::Time::Monotonic) - p->session->timestamp()) > _timeout)
- {
- string name = p->proxy->getName();
- p->proxy->destroy();
- cout << "The session " << name << " has timed out." << endl;
- p = _sessions.erase(p);
- }
- else
- {
- ++p;
- }
- }
- catch(const Ice::ObjectNotExistException&)
- {
- p = _sessions.erase(p);
- }
- }
-}
-
-void
-ReapTask::add(const SessionPrx& proxy, const SessionIPtr& session)
-{
- Lock sync(*this);
- _sessions.push_back(SessionProxyPair(proxy, session));
-}