diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-09-12 15:27:46 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-09-12 15:27:46 +0000 |
commit | d7b2c19bdc7bf86c6a183b77e3fc286f0319c986 (patch) | |
tree | a980bb70577452be6a737ef5c8e1628101a971c1 /cpp/src/IceGrid/AdapterCache.cpp | |
parent | adding para for bug 458 (diff) | |
download | ice-d7b2c19bdc7bf86c6a183b77e3fc286f0319c986.tar.bz2 ice-d7b2c19bdc7bf86c6a183b77e3fc286f0319c986.tar.xz ice-d7b2c19bdc7bf86c6a183b77e3fc286f0319c986.zip |
Added configuration for the number of replicas to use for replication.
Diffstat (limited to 'cpp/src/IceGrid/AdapterCache.cpp')
-rw-r--r-- | cpp/src/IceGrid/AdapterCache.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/cpp/src/IceGrid/AdapterCache.cpp b/cpp/src/IceGrid/AdapterCache.cpp index 67a2b438fcc..854b2815417 100644 --- a/cpp/src/IceGrid/AdapterCache.cpp +++ b/cpp/src/IceGrid/AdapterCache.cpp @@ -85,6 +85,16 @@ AdapterEntry::enableReplication(const LoadBalancingPolicyPtr& policy) Lock sync(*this); _replicated = true; _loadBalancing = policy; + istringstream is(policy->nReplicas); + is >> _loadBalancingNReplicas; + if(_loadBalancingNReplicas < 1) + { + _loadBalancingNReplicas = 1; + } + else if(_loadBalancingNReplicas > static_cast<int>(_servers.size())) + { + _loadBalancingNReplicas = _servers.size(); + } } } @@ -134,7 +144,7 @@ AdapterEntry::removeServer(const ServerEntryPtr& entry) } vector<pair<string, AdapterPrx> > -AdapterEntry::getProxies(int& endpointCount) +AdapterEntry::getProxies(int& nReplicas) { vector<ServerEntryPtr> servers; bool adaptive = false; @@ -201,10 +211,7 @@ AdapterEntry::getProxies(int& endpointCount) throw NodeUnreachableException(); } - // - // TODO: Set to a configurable number of replicas. - // - endpointCount = 1; //servers.size(); + nReplicas = _replicated ? _loadBalancingNReplicas : 1; return adapters; } |