geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject geode-native git commit: GEODE-2713: Wrap result collector lock in shared_ptr.
Date Wed, 05 Apr 2017 16:35:02 GMT
Repository: geode-native
Updated Branches:
  refs/heads/develop 95cdd6c7d -> 4707a37a2


GEODE-2713: Wrap result collector lock in shared_ptr.

- Ensure compliant formatting.
- Switch to std::make_shared.

This closes #74.


Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/4707a37a
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/4707a37a
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/4707a37a

Branch: refs/heads/develop
Commit: 4707a37a2016d07bb0451556b4f2edfc64911db3
Parents: 95cdd6c
Author: Sarge <mdodge@pivotal.io>
Authored: Fri Mar 24 11:06:29 2017 -0700
Committer: Jacob Barrett <jbarrett@pivotal.io>
Committed: Wed Apr 5 09:33:40 2017 -0700

----------------------------------------------------------------------
 src/cppcache/src/ThinClientPoolDM.cpp |  4 ++--
 src/cppcache/src/ThinClientPoolDM.hpp | 11 ++++++-----
 src/cppcache/src/ThinClientRegion.cpp |  8 ++++----
 src/cppcache/src/ThinClientRegion.hpp |  8 ++++++--
 4 files changed, 18 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode-native/blob/4707a37a/src/cppcache/src/ThinClientPoolDM.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientPoolDM.cpp b/src/cppcache/src/ThinClientPoolDM.cpp
index f6fc356..7c8fab5 100644
--- a/src/cppcache/src/ThinClientPoolDM.cpp
+++ b/src/cppcache/src/ThinClientPoolDM.cpp
@@ -609,7 +609,7 @@ GfErrType ThinClientPoolDM::sendRequestToAllServers(
   HostAsm::atomicAdd(m_clientOps, 1);
   getStats().setCurClientOps(m_clientOps);
 
-  ACE_Recursive_Thread_Mutex resultCollectorLock;
+  auto resultCollectorLock = std::make_shared<ACE_Recursive_Thread_Mutex>();
 
   CacheableStringArrayPtr csArray = getServers();
 
@@ -636,7 +636,7 @@ GfErrType ThinClientPoolDM::sendRequestToAllServers(
     }
     FunctionExecution* funcExe = &fePtrList[feIndex++];
     funcExe->setParameters(func, getResult, timeout, args, ep, this,
-                           &resultCollectorLock, &rs, userAttr);
+                           resultCollectorLock, &rs, userAttr);
     threadPool->perform(funcExe);
   }
   GfErrType finalErrorReturn = GF_NOERR;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/4707a37a/src/cppcache/src/ThinClientPoolDM.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientPoolDM.hpp b/src/cppcache/src/ThinClientPoolDM.hpp
index a4e1713..503cd60 100644
--- a/src/cppcache/src/ThinClientPoolDM.hpp
+++ b/src/cppcache/src/ThinClientPoolDM.hpp
@@ -26,6 +26,7 @@
 #include "PoolAttributes.hpp"
 #include "ThinClientLocatorHelper.hpp"
 #include "RemoteQueryService.hpp"
+#include <memory>
 #include <set>
 #include <vector>
 #include "Task.hpp"
@@ -440,7 +441,7 @@ class FunctionExecution : public PooledWork<GfErrType> {
   CacheablePtr m_args;
   GfErrType m_error;
   ResultCollectorPtr* m_rc;
-  ACE_Recursive_Thread_Mutex* m_resultCollectorLock;
+  std::shared_ptr<ACE_Recursive_Thread_Mutex> m_resultCollectorLock;
   CacheableStringPtr exceptionPtr;
   UserAttributesPtr m_userAttr;
 
@@ -453,7 +454,6 @@ class FunctionExecution : public PooledWork<GfErrType> {
     m_timeout = 0;
     m_error = GF_NOERR;
     m_rc = NULL;
-    m_resultCollectorLock = NULL;
     m_userAttr = NULLPTR;
   }
 
@@ -463,7 +463,8 @@ class FunctionExecution : public PooledWork<GfErrType> {
 
   void setParameters(const char* func, uint8_t getResult, uint32_t timeout,
                      CacheablePtr args, TcrEndpoint* ep,
-                     ThinClientPoolDM* poolDM, ACE_Recursive_Thread_Mutex* rCL,
+                     ThinClientPoolDM* poolDM,
+                     const std::shared_ptr<ACE_Recursive_Thread_Mutex>& rCL,
                      ResultCollectorPtr* rs, UserAttributesPtr userAttr) {
     exceptionPtr = NULLPTR;
     m_resultCollectorLock = rCL;
@@ -616,7 +617,7 @@ class OnRegionFunctionExecution : public PooledWork<GfErrType> {
   CacheableHashSetPtr m_routingObj;
   ResultCollectorPtr m_rc;
   TcrChunkedResult* m_resultCollector;
-  ACE_Recursive_Thread_Mutex* m_resultCollectorLock;
+  std::shared_ptr<ACE_Recursive_Thread_Mutex> m_resultCollectorLock;
   UserAttributesPtr m_userAttr;
   const Region* m_region;
   bool m_allBuckets;
@@ -625,7 +626,7 @@ class OnRegionFunctionExecution : public PooledWork<GfErrType> {
   OnRegionFunctionExecution(
       const char* func, const Region* region, CacheablePtr args,
       CacheableHashSetPtr routingObj, uint8_t getResult, uint32_t timeout,
-      ThinClientPoolDM* poolDM, ACE_Recursive_Thread_Mutex* rCL,
+      ThinClientPoolDM* poolDM, const std::shared_ptr<ACE_Recursive_Thread_Mutex>&
rCL,
       ResultCollectorPtr rs, UserAttributesPtr userAttr, bool isBGThread,
       BucketServerLocationPtr serverLocation, bool allBuckets)
       : m_serverLocation(serverLocation),

http://git-wip-us.apache.org/repos/asf/geode-native/blob/4707a37a/src/cppcache/src/ThinClientRegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientRegion.cpp b/src/cppcache/src/ThinClientRegion.cpp
index 387546c..189cb5e 100644
--- a/src/cppcache/src/ThinClientRegion.cpp
+++ b/src/cppcache/src/ThinClientRegion.cpp
@@ -3350,7 +3350,7 @@ bool ThinClientRegion::executeFunctionSH(
     HashMapT<BucketServerLocationPtr, CacheableHashSetPtr>* locationMap,
     CacheableHashSetPtr& failedNodes, uint32_t timeout, bool allBuckets) {
   bool reExecute = false;
-  ACE_Recursive_Thread_Mutex resultCollectorLock;
+  auto resultCollectorLock = std::make_shared<ACE_Recursive_Thread_Mutex>();
   UserAttributesPtr userAttr =
       TSSUserAttributesWrapper::s_geodeTSSUserAttributes->getUserAttributes();
   std::vector<OnRegionFunctionExecution*> feWorkers;
@@ -3363,7 +3363,7 @@ bool ThinClientRegion::executeFunctionSH(
     CacheableHashSetPtr buckets = locationIter.second();
     OnRegionFunctionExecution* worker = new OnRegionFunctionExecution(
         func, this, args, buckets, getResult, timeout,
-        dynamic_cast<ThinClientPoolDM*>(m_tcrdm), &resultCollectorLock, rc,
+        dynamic_cast<ThinClientPoolDM*>(m_tcrdm), resultCollectorLock, rc,
         userAttr, false, serverLocation, allBuckets);
     threadPool->perform(worker);
     feWorkers.push_back(worker);
@@ -3397,7 +3397,7 @@ bool ThinClientRegion::executeFunctionSH(
         }
         worker->getResultCollector()->reset();
         {
-          ACE_Guard<ACE_Recursive_Thread_Mutex> guard(resultCollectorLock);
+          ACE_Guard<ACE_Recursive_Thread_Mutex> guard(*resultCollectorLock);
           rc->clearResults();
         }
         CacheableHashSetPtr failedNodeIds(currentReply->getFailedNode());
@@ -3421,7 +3421,7 @@ bool ThinClientRegion::executeFunctionSH(
         }
         worker->getResultCollector()->reset();
         {
-          ACE_Guard<ACE_Recursive_Thread_Mutex> guard(resultCollectorLock);
+          ACE_Guard<ACE_Recursive_Thread_Mutex> guard(*resultCollectorLock);
           rc->clearResults();
         }
       } else {

http://git-wip-us.apache.org/repos/asf/geode-native/blob/4707a37a/src/cppcache/src/ThinClientRegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientRegion.hpp b/src/cppcache/src/ThinClientRegion.hpp
index 7885b2e..1d65fee 100644
--- a/src/cppcache/src/ThinClientRegion.hpp
+++ b/src/cppcache/src/ThinClientRegion.hpp
@@ -407,7 +407,7 @@ class ChunkedFunctionExecutionResponse : public TcrChunkedResult {
   // CacheableVectorPtr  m_functionExecutionResults;
   bool m_getResult;
   ResultCollectorPtr m_rc;
-  ACE_Recursive_Thread_Mutex* m_resultCollectorLock;
+  std::shared_ptr<ACE_Recursive_Thread_Mutex> m_resultCollectorLock;
 
   // disabled
   ChunkedFunctionExecutionResponse(const ChunkedFunctionExecutionResponse&);
@@ -415,9 +415,13 @@ class ChunkedFunctionExecutionResponse : public TcrChunkedResult {
       const ChunkedFunctionExecutionResponse&);
 
  public:
+  inline ChunkedFunctionExecutionResponse(TcrMessage& msg, bool getResult,
+                                          ResultCollectorPtr rc)
+      : TcrChunkedResult(), m_msg(msg), m_getResult(getResult), m_rc(rc) {}
+
   inline ChunkedFunctionExecutionResponse(
       TcrMessage& msg, bool getResult, ResultCollectorPtr rc,
-      ACE_Recursive_Thread_Mutex* resultCollectorLock = NULL)
+      const std::shared_ptr<ACE_Recursive_Thread_Mutex>& resultCollectorLock)
       : TcrChunkedResult(),
         m_msg(msg),
         m_getResult(getResult),


Mime
View raw message