merlimat commented on a change in pull request #561: Fix: CPP release 
baseCommand after serializing it
URL: https://github.com/apache/incubator-pulsar/pull/561#discussion_r127104714
 
 

 ##########
 File path: pulsar-client-cpp/lib/Commands.cc
 ##########
 @@ -43,16 +43,18 @@ SharedBuffer Commands::writeMessageWithSize(const 
BaseCommand& cmd) {
     return buffer;
 }
 
-SharedBuffer Commands::newPartitionMetadataRequest(BaseCommand& cmd, const 
std::string& topic, uint64_t requestId) {
+SharedBuffer Commands::newPartitionMetadataRequest(const std::string& topic, 
uint64_t requestId) {
+    BaseCommand cmd;
 
 Review comment:
   To avoid creating a new BaseCommand (and all internal objects) for each 
lookup: 
   
   ```cpp
   static BaseCommand cmd;
   static boost::mutex mutex:
   
   mutex.lock();
   // rest of the method
   mutex.unlock();
   return buffer;
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to