summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/DescriptorHelper.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-07-06 10:57:39 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-07-06 10:57:39 +0000
commit5dcdcde597b97f12d63c519cc6b7cb83c3820035 (patch)
tree60c0cd0779ecf7d61836ff8caf4fa3cca545dd0e /cpp/src/IceGrid/DescriptorHelper.cpp
parentrelease reference to servant asap (diff)
downloadice-5dcdcde597b97f12d63c519cc6b7cb83c3820035.tar.bz2
ice-5dcdcde597b97f12d63c519cc6b7cb83c3820035.tar.xz
ice-5dcdcde597b97f12d63c519cc6b7cb83c3820035.zip
Changed server start to wait for object adapter activation before to
return.
Diffstat (limited to 'cpp/src/IceGrid/DescriptorHelper.cpp')
-rw-r--r--cpp/src/IceGrid/DescriptorHelper.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp
index 65dfa8afbba..56ea2c235bb 100644
--- a/cpp/src/IceGrid/DescriptorHelper.cpp
+++ b/cpp/src/IceGrid/DescriptorHelper.cpp
@@ -490,6 +490,18 @@ XmlAttributesHelper::contains(const string& name)
return _attributes.find(name) != _attributes.end();
}
+int
+XmlAttributesHelper::asInt(const string& name, const string& def)
+{
+ int value;
+ istringstream v(operator()(name, def));
+ if(!(v >> value) || !v.eof())
+ {
+ return 0;
+ }
+ return value;
+}
+
string
XmlAttributesHelper::operator()(const string& name)
{
@@ -649,6 +661,29 @@ ApplicationDescriptorHelper::addServiceTemplate(const std::string& id, const Ice
return auto_ptr<ServiceDescriptorHelper>(new ServiceDescriptorHelper(*this, attrs, id));
}
+void
+ApplicationDescriptorHelper::addReplicatedAdapter(const IceXML::Attributes& attrs)
+{
+ XmlAttributesHelper attributes(_variables, attrs);
+
+ ReplicatedAdapterDescriptor adapter;
+ adapter.id = attributes("id");
+ string policy = attributes("load-balancing", "random");
+ if(policy == "random")
+ {
+ adapter.loadBalancing = Random;
+ }
+ else if(policy == "round-robin")
+ {
+ adapter.loadBalancing = RoundRobin;
+ }
+ else if(policy == "adaptive")
+ {
+ adapter.loadBalancing = Adaptive;
+ }
+ _descriptor->replicatedAdapters.push_back(adapter);
+}
+
ApplicationUpdateDescriptor
ApplicationDescriptorHelper::update(const ApplicationUpdateDescriptor& update)
{
@@ -1092,6 +1127,7 @@ ComponentDescriptorHelper::addAdapter(const IceXML::Attributes& attrs)
}
desc.endpoints = attributes("endpoints");
desc.registerProcess = attributes("register", "false") == "true";
+ desc.noWaitForActivation = attributes("noWaitForActivation", "false") == "true";
_descriptor->adapters.push_back(desc);
}
@@ -1227,6 +1263,8 @@ ServerDescriptorHelper::ServerDescriptorHelper(const DescriptorHelper& helper, c
_descriptor->exe = attributes("exe");
}
_descriptor->interpreter = interpreter;
+ _descriptor->activationTimeout = attributes.asInt("activation-timeout", "0");
+ _descriptor->deactivationTimeout = attributes.asInt("deactivation-timeout", "0");
ComponentDescriptorHelper::init(_descriptor, attrs);
@@ -1291,6 +1329,16 @@ ServerDescriptorHelper::operator==(const ServerDescriptorHelper& helper) const
return false;
}
+ if(_descriptor->activationTimeout != helper._descriptor->activationTimeout)
+ {
+ return false;
+ }
+
+ if(_descriptor->deactivationTimeout != helper._descriptor->deactivationTimeout)
+ {
+ return false;
+ }
+
if(set<string>(_descriptor->options.begin(), _descriptor->options.end()) !=
set<string>(helper._descriptor->options.begin(), helper._descriptor->options.end()))
{