summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-06-16 12:29:42 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-06-16 12:29:42 +0000
commit2cc2e228f93e4b75c0ae427ca3f7165653b18efc (patch)
treec575919a98e00526f024c32ce369e67e64586b59 /cpp
parentRemoved application attribute in ServerDescriptor, moved "node" attribute (diff)
downloadice-2cc2e228f93e4b75c0ae427ca3f7165653b18efc.tar.bz2
ice-2cc2e228f93e4b75c0ae427ca3f7165653b18efc.tar.xz
ice-2cc2e228f93e4b75c0ae427ca3f7165653b18efc.zip
Fixes
Diffstat (limited to 'cpp')
-rw-r--r--cpp/slice/IceGrid/Descriptor.ice7
-rw-r--r--cpp/src/IceGrid/Database.cpp48
-rw-r--r--cpp/src/IceGrid/DescriptorHelper.cpp17
-rw-r--r--cpp/src/IceGrid/Parser.cpp12
4 files changed, 39 insertions, 45 deletions
diff --git a/cpp/slice/IceGrid/Descriptor.ice b/cpp/slice/IceGrid/Descriptor.ice
index 0bdc3655b96..29281e340e2 100644
--- a/cpp/slice/IceGrid/Descriptor.ice
+++ b/cpp/slice/IceGrid/Descriptor.ice
@@ -227,13 +227,6 @@ class ServerDescriptor extends ComponentDescriptor
/**
*
- * The &IceGrid node on which the server is deployed.
- *
- **/
- string node;
-
- /**
- *
* The command line options to pass to the server executable.
*
**/
diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp
index 788611e868b..b91f4ea8206 100644
--- a/cpp/src/IceGrid/Database.cpp
+++ b/cpp/src/IceGrid/Database.cpp
@@ -1109,8 +1109,9 @@ Database::updateServers(const ApplicationDescriptorPtr& oldAppDesc, const Applic
{
if(p->descriptor->name == q->descriptor->name)
{
- if(ServerDescriptorHelper(oldAppDescHelper, ServerDescriptorPtr::dynamicCast(q->descriptor)) !=
- ServerDescriptorHelper(newAppDescHelper, ServerDescriptorPtr::dynamicCast(p->descriptor)))
+ if(q->node != p->node ||
+ ServerDescriptorHelper(oldAppDescHelper, q->descriptor) !=
+ ServerDescriptorHelper(newAppDescHelper, p->descriptor))
{
entries.push_back(updateServer(*p));
}
@@ -1137,9 +1138,8 @@ Database::removeServers(const string& application, const ServerInstanceDescripto
Database::ServerEntryPtr
Database::addServer(const string& application, const ServerInstanceDescriptor& instance)
{
- const ServerDescriptorPtr descriptor = ServerDescriptorPtr::dynamicCast(instance.descriptor);
ServerEntryPtr entry;
- map<string, ServerEntryPtr>::const_iterator q = _servers.find(descriptor->name);
+ map<string, ServerEntryPtr>::const_iterator q = _servers.find(instance.descriptor->name);
if(q != _servers.end())
{
entry = q->second;
@@ -1148,17 +1148,17 @@ Database::addServer(const string& application, const ServerInstanceDescriptor& i
else
{
entry = new ServerEntry(*this, instance);
- _servers.insert(make_pair(descriptor->name, entry));
+ _servers.insert(make_pair(instance.descriptor->name, entry));
}
- map<string, set<string> >::iterator p = _serversByNode.find(descriptor->node);
+ map<string, set<string> >::iterator p = _serversByNode.find(instance.node);
if(p == _serversByNode.end())
{
p = _serversByNode.insert(make_pair(instance.node, set<string>())).first;
}
- p->second.insert(p->second.begin(), descriptor->name);
+ p->second.insert(p->second.begin(), instance.descriptor->name);
- _applicationsByServerName.insert(make_pair(descriptor->name, application));
+ _applicationsByServerName.insert(make_pair(instance.descriptor->name, application));
forEachComponent(AddComponent(*this, entry))(instance);
return entry;
@@ -1171,9 +1171,8 @@ Database::updateServer(const ServerInstanceDescriptor& instance)
// Get the server entry and the current descriptor then check
// if the server descriptor really changed.
//
- const ServerDescriptorPtr descriptor = ServerDescriptorPtr::dynamicCast(instance.descriptor);
ServerEntryPtr entry;
- map<string, ServerEntryPtr>::const_iterator q = _servers.find(descriptor->name);
+ map<string, ServerEntryPtr>::const_iterator q = _servers.find(instance.descriptor->name);
assert(q != _servers.end());
entry = q->second;
@@ -1187,7 +1186,7 @@ Database::updateServer(const ServerInstanceDescriptor& instance)
{
map<string, set<string> >::iterator p = _serversByNode.find(old.node);
assert(p != _serversByNode.end());
- p->second.erase(descriptor->name);
+ p->second.erase(instance.descriptor->name);
if(p->second.empty())
{
_serversByNode.erase(p);
@@ -1197,7 +1196,7 @@ Database::updateServer(const ServerInstanceDescriptor& instance)
{
p = _serversByNode.insert(make_pair(instance.node, set<string>())).first;
}
- p->second.insert(p->second.begin(), descriptor->name);
+ p->second.insert(p->second.begin(), instance.descriptor->name);
}
//
@@ -1220,14 +1219,13 @@ Database::updateServer(const ServerInstanceDescriptor& instance)
Database::ServerEntryPtr
Database::removeServer(const string& application, const ServerInstanceDescriptor& instance)
{
- const ServerDescriptorPtr descriptor = ServerDescriptorPtr::dynamicCast(instance.descriptor);
ServerEntryPtr entry;
- map<string, ServerEntryPtr>::iterator q = _servers.find(descriptor->name);
+ map<string, ServerEntryPtr>::iterator q = _servers.find(instance.descriptor->name);
assert(q != _servers.end());
map<string, set<string> >::iterator p = _serversByNode.find(instance.node);
assert(p != _serversByNode.end());
- p->second.erase(descriptor->name);
+ p->second.erase(instance.descriptor->name);
if(p->second.empty())
{
_serversByNode.erase(p);
@@ -1236,7 +1234,7 @@ Database::removeServer(const string& application, const ServerInstanceDescriptor
entry = q->second;
entry->destroy();
- _applicationsByServerName.erase(descriptor->name);
+ _applicationsByServerName.erase(instance.descriptor->name);
//
// Remove the object adapters and objects.
@@ -1434,7 +1432,9 @@ ServerPrx
Database::ServerEntry::sync(map<string, AdapterPrx>& adapters)
{
ServerDescriptorPtr load;
+ string loadNode;
ServerDescriptorPtr destroy;
+ string destroyNode;
{
Lock sync(*this);
while(_synchronizing)
@@ -1449,8 +1449,16 @@ Database::ServerEntry::sync(map<string, AdapterPrx>& adapters)
_synchronizing = true;
_failed = false;
- load = _load.get() ? _load->descriptor : ServerDescriptorPtr();
- destroy = _destroy.get() ? _destroy->descriptor : ServerDescriptorPtr();
+ if(_load.get())
+ {
+ load = _load->descriptor;
+ loadNode = _load->node;
+ }
+ if(_destroy.get())
+ {
+ destroy = _destroy->descriptor;
+ destroyNode = _destroy->node;
+ }
}
ServerPrx proxy;
@@ -1460,7 +1468,7 @@ Database::ServerEntry::sync(map<string, AdapterPrx>& adapters)
{
try
{
- _database.getNode(destroy->node)->destroyServer(destroy->name);
+ _database.getNode(destroyNode)->destroyServer(destroy->name);
}
catch(const NodeNotExistException& ex)
{
@@ -1482,7 +1490,7 @@ Database::ServerEntry::sync(map<string, AdapterPrx>& adapters)
{
try
{
- proxy = _database.getNode(load->node)->loadServer(load, adapters);
+ proxy = _database.getNode(loadNode)->loadServer(load, adapters);
}
catch(const NodeNotExistException& ex)
{
diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp
index 72acb4dd26b..6366a584fa9 100644
--- a/cpp/src/IceGrid/DescriptorHelper.cpp
+++ b/cpp/src/IceGrid/DescriptorHelper.cpp
@@ -724,8 +724,8 @@ ApplicationDescriptorHelper::update(const ApplicationUpdateDescriptor& update)
ServerInstanceDescriptor inst = instantiate(*q); // Re-instantiate old server.
if(updated.find(inst.descriptor->name) == updated.end() && remove.find(inst.descriptor->name) == remove.end())
{
- if(ServerDescriptorHelper(*this, ServerDescriptorPtr::dynamicCast(q->descriptor)) !=
- ServerDescriptorHelper(*this, ServerDescriptorPtr::dynamicCast(inst.descriptor)))
+ if(q->node != inst.node ||
+ ServerDescriptorHelper(*this, q->descriptor) != ServerDescriptorHelper(*this, inst.descriptor))
{
newUpdate.servers.push_back(inst);
}
@@ -1045,7 +1045,6 @@ ServerDescriptorHelper::ServerDescriptorHelper(const DescriptorHelper& helper, c
ComponentDescriptorHelper::init(_descriptor, attrs);
- _descriptor->node = _variables->substitute("${node}");
_descriptor->pwd = attributes("pwd", "");
_descriptor->activation = attributes("activation", "manual");
@@ -1107,11 +1106,6 @@ ServerDescriptorHelper::operator==(const ServerDescriptorHelper& helper) const
return false;
}
- if(_descriptor->node != helper._descriptor->node)
- {
- return false;
- }
-
if(set<string>(_descriptor->options.begin(), _descriptor->options.end()) !=
set<string>(helper._descriptor->options.begin(), helper._descriptor->options.end()))
{
@@ -1169,8 +1163,8 @@ ServerDescriptorHelper::operator==(const ServerDescriptorHelper& helper) const
if(q->descriptor && p->descriptor->name == q->descriptor->name)
{
found = true;
- if(ServiceDescriptorHelper(*this, ServiceDescriptorPtr::dynamicCast(p->descriptor)) !=
- ServiceDescriptorHelper(*this, ServiceDescriptorPtr::dynamicCast(q->descriptor)))
+ if(ServiceDescriptorHelper(*this, p->descriptor) !=
+ ServiceDescriptorHelper(*this, q->descriptor))
{
return false;
}
@@ -1316,7 +1310,6 @@ ServerDescriptorHelper::instantiateImpl(const ServerDescriptorPtr& desc, set<str
ComponentDescriptorHelper::instantiateImpl(desc, missing);
- substitute(desc->node);
substitute(desc->exe);
substitute(desc->pwd);
for_each(desc->options.begin(), desc->options.end(), substitute);
@@ -1332,7 +1325,7 @@ ServerDescriptorHelper::instantiateImpl(const ServerDescriptorPtr& desc, set<str
{
if(p->_cpp_template.empty())
{
- ServiceDescriptorPtr service = ServiceDescriptorPtr::dynamicCast(p->descriptor);
+ ServiceDescriptorPtr service = p->descriptor;
assert(service);
p->descriptor = ServiceDescriptorHelper(*this, service).instantiate(missing);
}
diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp
index 9ca2ddbdaa4..d0f23c31f9f 100644
--- a/cpp/src/IceGrid/Parser.cpp
+++ b/cpp/src/IceGrid/Parser.cpp
@@ -579,13 +579,12 @@ Parser::describeApplication(const list<string>& args)
for(ServerInstanceDescriptorSeq::const_iterator p = application->servers.begin();
p != application->servers.end(); ++p)
{
- const ServerDescriptorPtr descriptor = ServerDescriptorPtr::dynamicCast(p->descriptor);
- map<string, set<string> >::iterator q = servers.find(descriptor->node);
+ map<string, set<string> >::iterator q = servers.find(p->node);
if(q == servers.end())
{
- q = servers.insert(make_pair(descriptor->node, set<string>())).first;
+ q = servers.insert(make_pair(p->node, set<string>())).first;
}
- q->second.insert(descriptor->name);
+ q->second.insert(p->descriptor->name);
}
}
{
@@ -823,8 +822,9 @@ Parser::diffApplication(const list<string>& args)
{
if(desc->name == q->descriptor->name)
{
- ServerDescriptorPtr orig = ServerDescriptorPtr::dynamicCast(q->descriptor);
- if(ServerDescriptorHelper(newAppHelper, desc) != ServerDescriptorHelper(origAppHelper, orig))
+ ServerDescriptorPtr orig = q->descriptor;
+ if(q->node != p->node ||
+ ServerDescriptorHelper(newAppHelper, desc) != ServerDescriptorHelper(origAppHelper, orig))
{
updated.insert(orig->name);
}