diff options
Diffstat (limited to 'cpp/src/IceGrid/NodeCache.cpp')
-rw-r--r-- | cpp/src/IceGrid/NodeCache.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp index afcedbe09f0..0005462bbf8 100644 --- a/cpp/src/IceGrid/NodeCache.cpp +++ b/cpp/src/IceGrid/NodeCache.cpp @@ -173,8 +173,13 @@ NodeEntryPtr NodeCache::get(const string& name, bool create) const { Lock sync(*this); - NodeCache& self = const_cast<NodeCache&>(*this); - NodeEntryPtr entry = self.getImpl(name, create); + NodeEntryPtr entry = getImpl(name); + if(!entry && create) + { + NodeCache& self = const_cast<NodeCache&>(*this); + entry = new NodeEntry(self, name); + self.addImpl(name, entry); + } if(!entry) { NodeNotExistException ex; @@ -184,7 +189,7 @@ NodeCache::get(const string& name, bool create) const return entry; } -NodeEntry::NodeEntry(Cache<string, NodeEntry>& cache, const std::string& name) : +NodeEntry::NodeEntry(NodeCache& cache, const std::string& name) : _cache(cache), _name(name) { |