summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/Client.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2018-10-23 12:20:39 +0200
committerBenoit Foucher <benoit@zeroc.com>2018-10-23 12:20:39 +0200
commitf95d74fdd4d3dc4f6cdb4b083d71cf83f2d0d7be (patch)
tree84ddc929b018c913ff2477cb05f7077f1be8e12d /cpp/src/IceGrid/Client.cpp
parentFixed Windows OpenSSL testing issue (diff)
downloadice-f95d74fdd4d3dc4f6cdb4b083d71cf83f2d0d7be.tar.bz2
ice-f95d74fdd4d3dc4f6cdb4b083d71cf83f2d0d7be.tar.xz
ice-f95d74fdd4d3dc4f6cdb4b083d71cf83f2d0d7be.zip
Removed keep alive thread from icegridadmin and IceGridGUI, only rely on ACM instead fixes #201
Diffstat (limited to 'cpp/src/IceGrid/Client.cpp')
-rw-r--r--cpp/src/IceGrid/Client.cpp79
1 files changed, 6 insertions, 73 deletions
diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp
index 604c042d173..36f7c502716 100644
--- a/cpp/src/IceGrid/Client.cpp
+++ b/cpp/src/IceGrid/Client.cpp
@@ -67,56 +67,6 @@ Init init;
}
-class SessionKeepAliveThread : public IceUtil::Thread, public IceUtil::Monitor<IceUtil::Mutex>
-{
-public:
-
- SessionKeepAliveThread(const IceGrid::AdminSessionPrx& session, long timeout) :
- IceUtil::Thread("IceGrid admin session keepalive thread"),
- _session(session),
- _timeout(IceUtil::Time::seconds(timeout)),
- _destroy(false)
- {
- }
-
- virtual void
- run()
- {
- Lock sync(*this);
- while(!_destroy)
- {
- timedWait(_timeout);
- if(_destroy)
- {
- break;
- }
- try
- {
- _session->keepAlive();
- }
- catch(const Ice::Exception&)
- {
- break;
- }
- }
- }
-
- void
- destroy()
- {
- Lock sync(*this);
- _destroy = true;
- notify();
- }
-
-private:
-
- IceGrid::AdminSessionPrx _session;
- const IceUtil::Time _timeout;
- bool _destroy;
-};
-typedef IceUtil::Handle<SessionKeepAliveThread> SessionKeepAliveThreadPtr;
-
class ReuseConnectionRouter : public Ice::Router
{
public:
@@ -331,8 +281,7 @@ run(const Ice::StringSeq& args)
if(opts.isSet("server"))
{
- Ice::ObjectAdapterPtr adapter =
- communicator->createObjectAdapter("IceGridAdmin.Server");
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("IceGridAdmin.Server");
adapter->activate();
Ice::ObjectPrx proxy = adapter->add(new FileParserI, Ice::stringToIdentity("FileParser"));
consoleOut << proxy << endl;
@@ -400,11 +349,9 @@ run(const Ice::StringSeq& args)
Glacier2::RouterPrx router;
IceGrid::AdminSessionPrx session;
- SessionKeepAliveThreadPtr keepAlive;
int status = 0;
try
{
- int sessionTimeout;
int acmTimeout = 0;
if(!communicator->getDefaultLocator() && !communicator->getDefaultRouter())
{
@@ -558,13 +505,15 @@ run(const Ice::StringSeq& args)
return 1;
}
}
- sessionTimeout = static_cast<int>(router->getSessionTimeout());
+
try
{
acmTimeout = router->getACMTimeout();
}
catch(const Ice::OperationNotExistException&)
{
+ consoleErr << args[0] << ": can't talk to old Glacier2 router version" << endl;
+ return 1;
}
}
else if(communicator->getDefaultLocator())
@@ -701,13 +650,14 @@ run(const Ice::StringSeq& args)
fill(password.begin(), password.end(), '\0'); // Zero the password string.
}
- sessionTimeout = registry->getSessionTimeout();
try
{
acmTimeout = registry->getACMTimeout();
}
catch(const Ice::OperationNotExistException&)
{
+ consoleErr << args[0] << ": can't talk to old IceGrid registry version" << endl;
+ return 1;
}
}
else // No default locator or router set.
@@ -721,11 +671,6 @@ run(const Ice::StringSeq& args)
{
session->ice_getConnection()->setACM(acmTimeout, IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways));
}
- else if(sessionTimeout > 0)
- {
- keepAlive = new SessionKeepAliveThread(session, sessionTimeout / 2);
- keepAlive->start();
- }
{
IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(_staticMutex);
@@ -768,12 +713,6 @@ run(const Ice::StringSeq& args)
}
catch(...)
{
- if(keepAlive)
- {
- keepAlive->destroy();
- keepAlive->getThreadControl().join();
- }
-
try
{
if(router)
@@ -791,12 +730,6 @@ run(const Ice::StringSeq& args)
throw;
}
- if(keepAlive)
- {
- keepAlive->destroy();
- keepAlive->getThreadControl().join();
- }
-
if(session)
{
try