summaryrefslogtreecommitdiff
path: root/cpp/src/IcePack/AdapterRegistryI.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-01-20 11:04:02 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-01-20 11:04:02 +0000
commit46bc9a1b8b086902e99eb5ae3d281dd2c6cd43ae (patch)
tree64b38c0ff3cf9496a49462cb56cc98464cab6be1 /cpp/src/IcePack/AdapterRegistryI.cpp
parent:changeLocator() (diff)
downloadice-46bc9a1b8b086902e99eb5ae3d281dd2c6cd43ae.tar.bz2
ice-46bc9a1b8b086902e99eb5ae3d281dd2c6cd43ae.tar.xz
ice-46bc9a1b8b086902e99eb5ae3d281dd2c6cd43ae.zip
Improved IcePack reliability.
Diffstat (limited to 'cpp/src/IcePack/AdapterRegistryI.cpp')
-rw-r--r--cpp/src/IcePack/AdapterRegistryI.cpp30
1 files changed, 11 insertions, 19 deletions
diff --git a/cpp/src/IcePack/AdapterRegistryI.cpp b/cpp/src/IcePack/AdapterRegistryI.cpp
index 158c639a481..7e6fbaf0c0e 100644
--- a/cpp/src/IcePack/AdapterRegistryI.cpp
+++ b/cpp/src/IcePack/AdapterRegistryI.cpp
@@ -14,15 +14,15 @@
using namespace std;
using namespace IcePack;
-IcePack::AdapterRegistryI::AdapterRegistryI(const Ice::CommunicatorPtr& communicator,
- const string& envName, const string& dbName,
+const string AdapterRegistryI::_dbName = "adapterregistry";
+
+IcePack::AdapterRegistryI::AdapterRegistryI(const Ice::CommunicatorPtr& communicator, const string& envName,
const TraceLevelsPtr& traceLevels) :
_connectionCache(Freeze::createConnection(communicator, envName)),
- _dictCache(_connectionCache, dbName),
+ _dictCache(_connectionCache, _dbName),
_traceLevels(traceLevels),
_envName(envName),
- _communicator(communicator),
- _dbName(dbName)
+ _communicator(communicator)
{
}
@@ -84,7 +84,7 @@ IcePack::AdapterRegistryI::add(const string& id, const AdapterPrx& adapter, cons
}
AdapterPrx
-IcePack::AdapterRegistryI::remove(const string& id, const Ice::Current&)
+IcePack::AdapterRegistryI::remove(const string& id, const AdapterPrx& orig, const Ice::Current&)
{
Freeze::ConnectionPtr connection = Freeze::createConnection(_communicator, _envName);
StringObjectProxyDict dict(connection, _dbName);
@@ -96,6 +96,10 @@ IcePack::AdapterRegistryI::remove(const string& id, const Ice::Current&)
}
AdapterPrx adapter = AdapterPrx::uncheckedCast(p->second);
+ if(orig != 0 && orig != adapter) // Only remove if the adapter is equal to the provided proxy (if not null)
+ {
+ return 0;
+ }
dict.erase(p);
if(_traceLevels->adapterRegistry > 0)
@@ -116,19 +120,7 @@ IcePack::AdapterRegistryI::findById(const string& id, const Ice::Current&)
StringObjectProxyDict::iterator p = dict.find(id);
if(p != dict.end())
{
- try
- {
- p->second->ice_ping();
- return AdapterPrx::uncheckedCast(p->second->ice_collocationOptimization(false));
- }
- catch(const Ice::ObjectNotExistException&)
- {
- dict.erase(p);
- }
- catch(const Ice::LocalException&)
- {
- return AdapterPrx::uncheckedCast(p->second->ice_collocationOptimization(false));
- }
+ return AdapterPrx::uncheckedCast(p->second->ice_collocationOptimization(false));
}
throw AdapterNotExistException();
}