diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-03-29 08:42:35 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-03-29 08:42:35 +0000 |
commit | f2b162b67c2382a2da555e7a960beaa3ab6b3997 (patch) | |
tree | 5ba1d3a23c1f6ea4e1792f77b762d2fb17bb7bde /cpp/src/IceGrid/AdapterCache.cpp | |
parent | Fixed invalid implicit conversion (diff) | |
download | ice-f2b162b67c2382a2da555e7a960beaa3ab6b3997.tar.bz2 ice-f2b162b67c2382a2da555e7a960beaa3ab6b3997.tar.xz ice-f2b162b67c2382a2da555e7a960beaa3ab6b3997.zip |
Random fixes.
Diffstat (limited to 'cpp/src/IceGrid/AdapterCache.cpp')
-rw-r--r-- | cpp/src/IceGrid/AdapterCache.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/cpp/src/IceGrid/AdapterCache.cpp b/cpp/src/IceGrid/AdapterCache.cpp index d7f263a349e..00bef5b40a7 100644 --- a/cpp/src/IceGrid/AdapterCache.cpp +++ b/cpp/src/IceGrid/AdapterCache.cpp @@ -18,6 +18,8 @@ using namespace std; using namespace IceGrid; +pointer_to_unary_function<int, int> ReplicaGroupEntry::_rand(IceUtil::random); + namespace IceGrid { @@ -332,17 +334,14 @@ ReplicaGroupEntry::getProxies(bool allRegistered, int& nReplicas) else if(AdaptiveLoadBalancingPolicyPtr::dynamicCast(_loadBalancing)) { replicas = _replicas; + random_shuffle(replicas.begin(), replicas.end(), _rand); adaptive = true; loadSample = _loadSample; } else// if(RandomLoadBalancingPolicyPtr::dynamicCast(_loadBalancing)) { replicas = _replicas; -#ifdef _MSC_VER - random_shuffle(replicas.begin(), replicas.end(), ptr_fun(IceUtil::random)); -#else - random_shuffle(replicas.begin(), replicas.end(), IceUtil::random); -#endif + random_shuffle(replicas.begin(), replicas.end(), _rand); } } @@ -352,11 +351,6 @@ ReplicaGroupEntry::getProxies(bool allRegistered, int& nReplicas) // This must be done outside the synchronization block since // the sort() will call and lock each server entry. // -#ifdef _MSC_VER - random_shuffle(replicas.begin(), replicas.end(), ptr_fun(IceUtil::random)); -#else - random_shuffle(replicas.begin(), replicas.end(), IceUtil::random); -#endif sort(replicas.begin(), replicas.end(), ServerLoadCI(loadSample)); } @@ -399,11 +393,7 @@ ReplicaGroupEntry::getLeastLoadedNodeLoad(LoadSample loadSample) const // This must be done outside the synchronization block since // min_element() will call and lock each server entry. // -#ifdef _MSC_VER - random_shuffle(replicas.begin(), replicas.end(), ptr_fun(IceUtil::random)); -#else - random_shuffle(replicas.begin(), replicas.end(), IceUtil::random); -#endif + random_shuffle(replicas.begin(), replicas.end(), _rand); AdapterEntryPtr adpt = min_element(replicas.begin(), replicas.end(), ServerLoadCI(loadSample))->second; return adpt->getLeastLoadedNodeLoad(loadSample); } |