diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-11-29 14:40:22 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-11-29 14:40:22 +0000 |
commit | 8fdb96f93af7f6ac27ecb50ea4a5f22856b8546c (patch) | |
tree | 463ee5268393e18f55fdf9da9946e2960ca7899c /cpp/src/IceGrid/AllocatableObjectCache.cpp | |
parent | Fixes (diff) | |
download | ice-8fdb96f93af7f6ac27ecb50ea4a5f22856b8546c.tar.bz2 ice-8fdb96f93af7f6ac27ecb50ea4a5f22856b8546c.tar.xz ice-8fdb96f93af7f6ac27ecb50ea4a5f22856b8546c.zip |
More bug fixes
Diffstat (limited to 'cpp/src/IceGrid/AllocatableObjectCache.cpp')
-rw-r--r-- | cpp/src/IceGrid/AllocatableObjectCache.cpp | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/cpp/src/IceGrid/AllocatableObjectCache.cpp b/cpp/src/IceGrid/AllocatableObjectCache.cpp index 8be86c60f7e..7f57e3a4f2d 100644 --- a/cpp/src/IceGrid/AllocatableObjectCache.cpp +++ b/cpp/src/IceGrid/AllocatableObjectCache.cpp @@ -162,28 +162,37 @@ AllocatableObjectCache::get(const Ice::Identity& id) const return entry; } -AllocatableObjectEntryPtr +void AllocatableObjectCache::remove(const Ice::Identity& id) { - Lock sync(*this); - AllocatableObjectEntryPtr entry = getImpl(id); - assert(entry); - removeImpl(id); + AllocatableObjectEntryPtr entry; + { + Lock sync(*this); + entry = getImpl(id); + assert(entry); + removeImpl(id); + + map<string, TypeEntry>::iterator p = _types.find(entry->getType()); + assert(p != _types.end()); + if(p->second.remove(entry)) + { + _types.erase(p); + } - map<string, TypeEntry>::iterator p = _types.find(entry->getType()); - assert(p != _types.end()); - if(p->second.remove(entry)) - { - _types.erase(p); + if(_traceLevels && _traceLevels->object > 0) + { + Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat); + out << "removed allocatable object `" << _communicator->identityToString(id) << "'"; + } } - if(_traceLevels && _traceLevels->object > 0) - { - Ice::Trace out(_traceLevels->logger, _traceLevels->objectCat); - out << "removed allocatable object `" << _communicator->identityToString(id) << "'"; - } - - return entry; + // + // This must be done outside the synchronization because destroy + // might release the object and release might try to callback on + // the cache. + // + assert(entry); + entry->destroy(); } void @@ -345,7 +354,16 @@ AllocatableObjectEntry::destroy() _destroyed = true; session = _session; } - release(session); + if(session) + { + try + { + release(session); + } + catch(const AllocationException&) + { + } + } } void |