summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/ServerCache.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2006-12-01 09:03:37 +0000
committerBenoit Foucher <benoit@zeroc.com>2006-12-01 09:03:37 +0000
commit2d918e1915c9151c298eec7b92d83e0cb45d8b4a (patch)
treebb743120f656c209a671e083c78e408d89fb1234 /cpp/src/IceGrid/ServerCache.cpp
parentAllow hello demo to better test timeouts (diff)
downloadice-2d918e1915c9151c298eec7b92d83e0cb45d8b4a.tar.bz2
ice-2d918e1915c9151c298eec7b92d83e0cb45d8b4a.tar.xz
ice-2d918e1915c9151c298eec7b92d83e0cb45d8b4a.zip
Use deactivation timeout for loadServer call
Diffstat (limited to 'cpp/src/IceGrid/ServerCache.cpp')
-rw-r--r--cpp/src/IceGrid/ServerCache.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/cpp/src/IceGrid/ServerCache.cpp b/cpp/src/IceGrid/ServerCache.cpp
index 8da34d4ffca..ba6a18f73a2 100644
--- a/cpp/src/IceGrid/ServerCache.cpp
+++ b/cpp/src/IceGrid/ServerCache.cpp
@@ -233,6 +233,8 @@ ServerEntry::unload()
}
_proxy = 0;
_adapters.clear();
+ _activationTimeout = -1;
+ _deactivationTimeout = -1;
}
void
@@ -473,6 +475,7 @@ ServerEntry::syncImpl(bool waitForUpdate)
ServerInfo load;
SessionIPtr session;
ServerInfo destroy;
+ int timeout = -1;
{
Lock sync(*this);
@@ -507,6 +510,7 @@ ServerEntry::syncImpl(bool waitForUpdate)
{
load = *_load;
session = _session;
+ timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server.
}
else
{
@@ -531,7 +535,7 @@ ServerEntry::syncImpl(bool waitForUpdate)
{
try
{
- _cache.getNodeCache().get(load.node)->loadServer(this, load, session);
+ _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout);
}
catch(NodeNotExistException&)
{
@@ -576,6 +580,7 @@ ServerEntry::loadCallback(const ServerPrx& proxy, const AdapterPrxDict& adpts, i
ServerInfo load;
SessionIPtr session;
ServerInfo destroy;
+ int timeout = -1;
{
Lock sync(*this);
@@ -611,6 +616,7 @@ ServerEntry::loadCallback(const ServerPrx& proxy, const AdapterPrxDict& adpts, i
{
load = *_load;
session = _session;
+ timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server.
}
}
}
@@ -631,7 +637,7 @@ ServerEntry::loadCallback(const ServerPrx& proxy, const AdapterPrxDict& adpts, i
{
try
{
- _cache.getNodeCache().get(load.node)->loadServer(this, load, session);
+ _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout);
}
catch(NodeNotExistException&)
{
@@ -651,6 +657,8 @@ ServerEntry::destroyCallback()
_destroy.reset(0);
_proxy = 0;
_adapters.clear();
+ _activationTimeout = -1;
+ _deactivationTimeout = -1;
if(!_load.get())
{
@@ -670,7 +678,7 @@ ServerEntry::destroyCallback()
{
try
{
- _cache.getNodeCache().get(load.node)->loadServer(this, load, session);
+ _cache.getNodeCache().get(load.node)->loadServer(this, load, session, -1);
}
catch(NodeNotExistException&)
{
@@ -689,6 +697,7 @@ ServerEntry::exception(const Ice::Exception& ex)
ServerInfo load;
SessionIPtr session;
bool remove = false;
+ int timeout = -1;
{
Lock sync(*this);
@@ -699,6 +708,8 @@ ServerEntry::exception(const Ice::Exception& ex)
_exception.reset(ex.ice_clone());
_proxy = 0;
_adapters.clear();
+ _activationTimeout = -1;
+ _deactivationTimeout = -1;
_synchronizing = false;
notifyAll();
}
@@ -708,6 +719,7 @@ ServerEntry::exception(const Ice::Exception& ex)
_updated = false;
load = *_load.get();
session = _session;
+ timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server.
}
}
@@ -715,7 +727,7 @@ ServerEntry::exception(const Ice::Exception& ex)
{
try
{
- _cache.getNodeCache().get(load.node)->loadServer(this, load, session);
+ _cache.getNodeCache().get(load.node)->loadServer(this, load, session, timeout);
}
catch(NodeNotExistException&)
{