diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-09-13 10:09:50 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-09-13 10:09:50 +0000 |
commit | e65e272d55bfe9f9d26de43b73721c04b683234a (patch) | |
tree | 0b0e04bbaf26fe357a1620e4725986d5d750c003 /cpp/src/IceGrid/ReplicaCache.cpp | |
parent | Fixed for VC6 (STLport bug?) (diff) | |
download | ice-e65e272d55bfe9f9d26de43b73721c04b683234a.tar.bz2 ice-e65e272d55bfe9f9d26de43b73721c04b683234a.tar.xz ice-e65e272d55bfe9f9d26de43b73721c04b683234a.zip |
Fixes
Diffstat (limited to 'cpp/src/IceGrid/ReplicaCache.cpp')
-rw-r--r-- | cpp/src/IceGrid/ReplicaCache.cpp | 153 |
1 files changed, 0 insertions, 153 deletions
diff --git a/cpp/src/IceGrid/ReplicaCache.cpp b/cpp/src/IceGrid/ReplicaCache.cpp index 8eb940fa669..f411e170730 100644 --- a/cpp/src/IceGrid/ReplicaCache.cpp +++ b/cpp/src/IceGrid/ReplicaCache.cpp @@ -88,11 +88,6 @@ ReplicaCache::remove(const string& name) Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat); out << "replica `" << name << "' down"; } - - // - // Remove the replica expected updates. - // - removeReplicaUpdates(name); } try @@ -177,154 +172,6 @@ ReplicaCache::getEndpoints(const string& name, const Ice::ObjectPrx& proxy) cons return _communicator->stringToProxy("dummy")->ice_endpoints(endpoints); } -void -ReplicaCache::waitForUpdateReplication(const string& name, int serial) -{ - Lock sync(*this); - if(_entries.empty()) - { - return; - } - - vector<string> replicas; - for(map<string, ReplicaEntryPtr>::const_iterator s = _entries.begin(); s != _entries.end(); ++s) - { - replicas.push_back(s->first); - } - - ostringstream os; - os << name << "-" << serial; - const string key = os.str(); - - _waitForUpdates.insert(make_pair(key, set<string>(replicas.begin(), replicas.end()))); - - // - // Wait until all the updates are received. - // - while(true) - { - map<string, set<string> >::const_iterator p = _waitForUpdates.find(key); - if(p == _waitForUpdates.end()) - { - map<string, map<string, string> >::iterator q = _updateFailures.find(key); - if(q != _updateFailures.end()) - { - map<string, string> failures = q->second; - _updateFailures.erase(q); - - ostringstream os; - for(map<string, string>::const_iterator r = failures.begin(); r != failures.end(); ++r) - { - os << "replication failed on replica `" << r->first << "':\n" << r->second << "\n"; - } - Ice::Error err(_traceLevels->logger); - err << os.str(); - } - return; - } - else - { - wait(); - } - } -} - -void -ReplicaCache::replicaReceivedUpdate(const string& name, const string& update, int serial, const string& failure) -{ - Lock sync(*this); - - ostringstream os; - os << update << "-" << serial; - const string key = os.str(); - - map<string, set<string> >::iterator p = _waitForUpdates.find(key); - if(p != _waitForUpdates.end()) - { - p->second.erase(name); - - if(!failure.empty()) - { - map<string, map<string, string> >::iterator q = _updateFailures.find(key); - if(q == _updateFailures.end()) - { - q = _updateFailures.insert(make_pair(key, map<string ,string>())).first; - } - q->second.insert(make_pair(name, failure)); - } - - if(p->second.empty()) - { - _waitForUpdates.erase(p); - notifyAll(); - } - } -} - -void -ReplicaCache::startApplicationReplication(const string& application, int revision) -{ - // - // Add the given application to the set of application being - // replicated. - // - Lock sync(*this); - _applicationReplication.insert(application); -} - - -void -ReplicaCache::finishApplicationReplication(const string& application, int revision) -{ - // - // Notify waiting threads that the given application replication - // is completed. - // - Lock sync(*this); - _applicationReplication.erase(application); - notifyAll(); -} - -void -ReplicaCache::waitForApplicationReplication(const string& application, int revision) -{ - // - // Wait for the given application to be replicated. - // - Lock sync(*this); - while(_applicationReplication.find(application) != _applicationReplication.end()) - { - wait(); - } -} - -void -ReplicaCache::removeReplicaUpdates(const string& name) -{ - // Must b called within the synchronization. - - map<string, set<string> >::iterator p = _waitForUpdates.begin(); - bool notifyMonitor = false; - while(p != _waitForUpdates.end()) - { - p->second.erase(name); - if(p->second.empty()) - { - _waitForUpdates.erase(p++); - notifyMonitor = true; - } - else - { - ++p; - } - } - - if(notifyMonitor) - { - notifyAll(); - } -} - ReplicaEntry::ReplicaEntry(const std::string& name, const ReplicaSessionIPtr& session) : _name(name), _session(session) |