diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-11-03 09:27:47 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-11-03 09:27:47 +0000 |
commit | e68a0e117ee67b3b0e3f64e14da73802e7877814 (patch) | |
tree | 62fc9806929cc447a694a1a5d094271766b998e4 /cpp/src/IceGrid/DescriptorHelper.cpp | |
parent | Added some IceVb stuff (diff) | |
download | ice-e68a0e117ee67b3b0e3f64e14da73802e7877814.tar.bz2 ice-e68a0e117ee67b3b0e3f64e14da73802e7877814.tar.xz ice-e68a0e117ee67b3b0e3f64e14da73802e7877814.zip |
Added ordered load balancing
Diffstat (limited to 'cpp/src/IceGrid/DescriptorHelper.cpp')
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.cpp | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index e897cd56d74..44ed4a8f2d4 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -536,6 +536,10 @@ Resolver::asInt(const string& value, const string& name) const ex.reason = "invalid value `" + value + "' for `" + name + "' in " + _context + ": not an integer"; throw ex; } + + ostringstream os; + os << val; + v = os.str(); } return v; } @@ -940,6 +944,7 @@ CommunicatorHelper::instantiateImpl(const CommunicatorDescriptorPtr& instance, c { resolve.exception("unknown replica group `" + adapter.replicaGroupId + "'"); } + adapter.priority = resolve.asInt(p->priority, "object adapter priority"); adapter.objects = resolve(p->objects, "well-known"); adapter.allocatables = resolve(p->allocatables, "allocatable"); instance->adapters.push_back(adapter); @@ -1033,6 +1038,10 @@ CommunicatorHelper::printObjectAdapter(Output& out, const AdapterDescriptor& ada { out << nl << "replica group id = `" << adapter.replicaGroupId << "'"; } + if(!adapter.priority.empty()) + { + out << nl << "priority = `" << adapter.priority << "'"; + } string endpoints = getProperty(adapter.name + ".Endpoints"); if(!endpoints.empty()) { @@ -2288,22 +2297,26 @@ ApplicationHelper::ApplicationHelper(const Ice::CommunicatorPtr& communicator, c ReplicaGroupDescriptor desc; desc.id = r->id; desc.description = resolve(r->description, "replica group description"); - desc.objects = resolve(r->objects, "well-known"); - - if(r->loadBalancing) + desc.objects = resolve(r->objects, "replica group well-known"); + if(!r->loadBalancing) + { + resolve.exception("replica group load balancing is not set"); + } + desc.loadBalancing = LoadBalancingPolicyPtr::dynamicCast(r->loadBalancing->ice_clone()); + desc.loadBalancing->nReplicas = resolve.asInt(r->loadBalancing->nReplicas, "replica group number of replicas"); + if(desc.loadBalancing->nReplicas[0] == '-') { - desc.loadBalancing = LoadBalancingPolicyPtr::dynamicCast(r->loadBalancing->ice_clone()); - desc.loadBalancing->nReplicas = resolve(r->loadBalancing->nReplicas, "replica group number of replicas"); - AdaptiveLoadBalancingPolicyPtr al = AdaptiveLoadBalancingPolicyPtr::dynamicCast(desc.loadBalancing); - if(al) + resolve.exception("invalid replica group load balancing number of replicas value: inferior to 0"); + } + AdaptiveLoadBalancingPolicyPtr al = AdaptiveLoadBalancingPolicyPtr::dynamicCast(desc.loadBalancing); + if(al) + { + al->loadSample = resolve(al->loadSample, "replica group load sample"); + if(al->loadSample != "" && al->loadSample != "1" && al->loadSample != "5" && al->loadSample != "15") { - al->loadSample = resolve(al->loadSample, "replica group load sample"); - if(al->loadSample != "" && al->loadSample != "1" && al->loadSample != "5" && al->loadSample != "15") - { - resolve.exception("invalid load sample value (allowed values are 1, 5 or 15)"); - } + resolve.exception("invalid load sample value (allowed values are 1, 5 or 15)"); } - } + } _instance.replicaGroups.push_back(desc); } |