summaryrefslogtreecommitdiffstats
path: root/messagebus/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-07-24 15:20:02 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2017-07-24 15:20:02 +0000
commit3565bd357c11b7fa5c3c14ce407c765d44ad91f4 (patch)
treebbf053e089632848e2b6ab7d7913af066f250b43 /messagebus/src
parent74ebe62ec310cb56da390a9310031b4b914ac85f (diff)
Avoid temporaries and move string construction outside lock.
Diffstat (limited to 'messagebus/src')
-rw-r--r--messagebus/src/vespa/messagebus/protocolrepository.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/messagebus/src/vespa/messagebus/protocolrepository.cpp b/messagebus/src/vespa/messagebus/protocolrepository.cpp
index 681af440a89..26f6b53361f 100644
--- a/messagebus/src/vespa/messagebus/protocolrepository.cpp
+++ b/messagebus/src/vespa/messagebus/protocolrepository.cpp
@@ -52,8 +52,9 @@ ProtocolRepository::getRoutingPolicy(const string &protocolName,
const string &policyName,
const string &policyParam)
{
+ string cacheKey = protocolName;
+ cacheKey.append('.').append(policyName).append(".").append(policyParam);
vespalib::LockGuard guard(_lock);
- string cacheKey = protocolName + "." + policyName + "." + policyParam;
RoutingPolicyCache::iterator cit = _routingPolicyCache.find(cacheKey);
if (cit != _routingPolicyCache.end()) {
return cit->second;
@@ -67,12 +68,10 @@ ProtocolRepository::getRoutingPolicy(const string &protocolName,
try {
policy = pit->second->createPolicy(policyName, policyParam);
} catch (const std::exception &e) {
- LOG(error, "Protocol '%s' threw an exception; %s",
- protocolName.c_str(), e.what());
+ LOG(error, "Protocol '%s' threw an exception; %s", protocolName.c_str(), e.what());
}
if (policy.get() == NULL) {
- LOG(error, "Protocol '%s' failed to create routing policy '%s' "
- "with parameter '%s'.",
+ LOG(error, "Protocol '%s' failed to create routing policy '%s' with parameter '%s'.",
protocolName.c_str(), policyName.c_str(), policyParam.c_str());
return IRoutingPolicy::SP();
}