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_r127129223
 
 

 ##########
 File path: pulsar-client-cpp/lib/Commands.cc
 ##########
 @@ -23,10 +23,15 @@
 #include "LogUtils.h"
 #include "checksum/ChecksumProvider.h"
 #include <algorithm>
+#include <boost/thread/mutex.hpp>
+
 namespace pulsar {
 
 using namespace pulsar::proto;
 
+static BaseCommand cmd;
+static boost::mutex mutex;
 
 Review comment:
   Last comment (I promise). I was meaning for the 2 static objects to be 
declared directly in their methods. Eg:
   
   ```cpp
   SharedBuffer Commands::newPartitionMetadataRequest(const std::string& topic, 
uint64_t requestId) {
       static BaseCommand cmd;
       static boost::mutex mutex;
   
        mutex.lock();
       cmd....
       ....
   ```
   
   That makes more clear the scope in which the `cmd` and `mutex` are used.
 
----------------------------------------------------------------
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