diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-10-18 17:38:50 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-10-18 17:38:50 +0000 |
commit | 1485e01f77f42c13fb6bd17d6289f7277cdac9cf (patch) | |
tree | d0bb149ea54644e9161eedd008c35ead1c9faeb5 /cpp/src/IceGrid/Database.cpp | |
parent | Fixed compile error (diff) | |
download | ice-1485e01f77f42c13fb6bd17d6289f7277cdac9cf.tar.bz2 ice-1485e01f77f42c13fb6bd17d6289f7277cdac9cf.tar.xz ice-1485e01f77f42c13fb6bd17d6289f7277cdac9cf.zip |
Fixed bug 518
Diffstat (limited to 'cpp/src/IceGrid/Database.cpp')
-rw-r--r-- | cpp/src/IceGrid/Database.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp index 2ee26fcbc31..1d696680561 100644 --- a/cpp/src/IceGrid/Database.cpp +++ b/cpp/src/IceGrid/Database.cpp @@ -409,6 +409,50 @@ Database::removeApplicationDescriptor(ObserverSessionI* session, const std::stri for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); } +void +Database::instantiateServer(const string& application, const string& node, const ServerInstanceDescriptor& instance) +{ + ServerEntrySeq entries; + int serial; + ApplicationUpdateDescriptor update; + { + Lock sync(*this); + checkSessionLock(0); + + StringApplicationDescriptorDict::const_iterator p = _descriptors.find(application); + if(p == _descriptors.end()) + { + throw ApplicationNotExistException(application); + } + + ApplicationHelper previous(p->second); + ApplicationHelper helper(p->second); + helper.instantiateServer(node, instance); + update = helper.diff(previous); + + checkForUpdate(previous, helper); + + reload(previous, helper, entries); + + _descriptors.put(StringApplicationDescriptorDict::value_type(application, helper.getDescriptor())); + + serial = ++_serial; + } + + // + // Notify the observers. + // + _registryObserver->applicationUpdated(serial, update); + + if(_traceLevels->application > 0) + { + Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat); + out << "updated application `" << update.name << "'"; + } + + for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); +} + ApplicationDescriptor Database::getApplicationDescriptor(const std::string& name) { |