geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgkim...@apache.org
Subject [geode-native] branch develop updated: GEODE-4412: Remove std::enable_shared_from_this from Cache hierarchy (#211)
Date Wed, 07 Feb 2018 16:17:31 GMT
This is an automated email from the ASF dual-hosted git repository.

dgkimura pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 043f152  GEODE-4412: Remove std::enable_shared_from_this from Cache hierarchy (#211)
043f152 is described below

commit 043f152f649afdde953a077e277bed6353890812
Author: David Kimura <dkimura@pivotal.io>
AuthorDate: Wed Feb 7 08:17:29 2018 -0800

    GEODE-4412: Remove std::enable_shared_from_this from Cache hierarchy (#211)
---
 clicache/src/PoolManager.cpp                               | 4 ----
 cppcache/include/geode/Cache.hpp                           | 3 +--
 cppcache/include/geode/Region.hpp                          | 2 +-
 cppcache/integration-test/ThinClientPutAll.hpp             | 8 ++++----
 cppcache/integration-test/ThinClientPutAllWithCallBack.hpp | 8 ++++----
 cppcache/integration-test/testOverflowPutGetSqLite.cpp     | 4 ++--
 cppcache/src/LocalRegion.cpp                               | 4 ++--
 cppcache/src/LocalRegion.hpp                               | 2 +-
 cppcache/src/ProxyRegion.hpp                               | 4 ++--
 9 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/clicache/src/PoolManager.cpp b/clicache/src/PoolManager.cpp
index 585afc2..0b85b51 100644
--- a/clicache/src/PoolManager.cpp
+++ b/clicache/src/PoolManager.cpp
@@ -15,10 +15,6 @@
  * limitations under the License.
  */
 
-
-
-
-
 #include "Region.hpp"
 #include "Pool.hpp"
 #include "PoolManager.hpp"
diff --git a/cppcache/include/geode/Cache.hpp b/cppcache/include/geode/Cache.hpp
index ed753b2..5e8295a 100644
--- a/cppcache/include/geode/Cache.hpp
+++ b/cppcache/include/geode/Cache.hpp
@@ -62,8 +62,7 @@ class RegionFactory;
  * <p>A cache can have multiple root regions, each with a different name.
  *
  */
-class _GEODE_EXPORT Cache : public GeodeCache,
-                            public std::enable_shared_from_this<Cache> {
+class _GEODE_EXPORT Cache : public GeodeCache {
   /**
    * @brief public methods
    */
diff --git a/cppcache/include/geode/Region.hpp b/cppcache/include/geode/Region.hpp
index 84e1983..7c516c5 100644
--- a/cppcache/include/geode/Region.hpp
+++ b/cppcache/include/geode/Region.hpp
@@ -1033,7 +1033,7 @@ class _GEODE_EXPORT Region : public std::enable_shared_from_this<Region>
{
    * Returns the <code>cache</code> associated with this region.
    * @return the cache
    */
-  virtual std::shared_ptr<RegionService> getRegionService() const = 0;
+  virtual RegionService& getRegionService() const = 0;
 
   virtual bool isDestroyed() const = 0;
 
diff --git a/cppcache/integration-test/ThinClientPutAll.hpp b/cppcache/integration-test/ThinClientPutAll.hpp
index b04566a..b7b355b 100644
--- a/cppcache/integration-test/ThinClientPutAll.hpp
+++ b/cppcache/integration-test/ThinClientPutAll.hpp
@@ -593,12 +593,12 @@ END_TASK_DEFINITION
 DUNIT_TASK_DEFINITION(CLIENT1, StepTen)
   {
     auto regPtr0 = getHelper()->getRegion(regionNames[0]);
-    auto rsp = regPtr0->getRegionService();
-    auto regPtr = rsp->getRegion(regionNames[0]);
+    auto& rsp = regPtr0->getRegionService();
+    auto regPtr = rsp.getRegion(regionNames[0]);
     ASSERT(regPtr != nullptr, "Failed to get region.");
 
-    auto rsp1 = regPtr0->getRegionService();
-    auto regPtr1 = rsp1->getRegion("NOT_CREATED_REGION");
+    auto& rsp1 = regPtr0->getRegionService();
+    auto regPtr1 = rsp1.getRegion("NOT_CREATED_REGION");
     ASSERT(regPtr1 == nullptr, "Unknown Region Returned");
 
     LOG("StepTen complete.");
diff --git a/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp b/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
index 82f576c..cda74d2 100644
--- a/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
+++ b/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
@@ -603,12 +603,12 @@ END_TASK_DEFINITION
 DUNIT_TASK_DEFINITION(CLIENT1, VerifyRegionService)
   {
     auto regPtr0 = getHelper()->getRegion(regionNames[0]);
-    auto rsp = regPtr0->getRegionService();
-    auto regPtr = rsp->getRegion(regionNames[0]);
+    auto& rsp = regPtr0->getRegionService();
+    auto regPtr = rsp.getRegion(regionNames[0]);
     ASSERT(regPtr != nullptr, "Failed to get region.");
 
-    auto rsp1 = regPtr0->getRegionService();
-    auto regPtr1 = rsp1->getRegion("NOT_CREATED_REGION");
+    auto& rsp1 = regPtr0->getRegionService();
+    auto regPtr1 = rsp1.getRegion("NOT_CREATED_REGION");
     ASSERT(regPtr1 == nullptr, "Unknown Region Returned");
 
     LOG("VerifyRegionService complete.");
diff --git a/cppcache/integration-test/testOverflowPutGetSqLite.cpp b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
index 8497789..e1e13be 100644
--- a/cppcache/integration-test/testOverflowPutGetSqLite.cpp
+++ b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
@@ -399,7 +399,7 @@ BEGIN_TEST(OverFlowTest)
              "persistence file still present");
     }
     // cache close
-    regionPtr->getRegionService()->close();
+    regionPtr->getRegionService().close();
   }
 END_TEST(OverFlowTest)
 
@@ -459,7 +459,7 @@ BEGIN_TEST(OverFlowTest_absPath)
              "persistence file still present");
     }
     // cache close
-    regionPtr->getRegionService()->close();
+    regionPtr->getRegionService().close();
   }
 END_TEST(OverFlowTest_absPath)
 
diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp
index 44c50d5..c8f7572 100644
--- a/cppcache/src/LocalRegion.cpp
+++ b/cppcache/src/LocalRegion.cpp
@@ -580,9 +580,9 @@ uint32_t LocalRegion::size() {
 
   return LocalRegion::size_remote();
 }
-std::shared_ptr<RegionService> LocalRegion::getRegionService() const {
+RegionService& LocalRegion::getRegionService() const {
   CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getRegionService);
-  return m_cacheImpl->getCache()->shared_from_this();
+  return *m_cacheImpl->getCache();
 }
 
 CacheImpl* LocalRegion::getCacheImpl() const {
diff --git a/cppcache/src/LocalRegion.hpp b/cppcache/src/LocalRegion.hpp
index c6fc4db..a9995b2 100644
--- a/cppcache/src/LocalRegion.hpp
+++ b/cppcache/src/LocalRegion.hpp
@@ -242,7 +242,7 @@ class _GEODE_EXPORT LocalRegion : public RegionInternal {
                      nullptr) override;
   uint32_t size() override;
   virtual uint32_t size_remote();
-  std::shared_ptr<RegionService> getRegionService() const override;
+  RegionService& getRegionService() const override;
   virtual bool containsValueForKey_remote(
       const std::shared_ptr<CacheableKey>& keyPtr) const;
   bool containsValueForKey(
diff --git a/cppcache/src/ProxyRegion.hpp b/cppcache/src/ProxyRegion.hpp
index 3cc0b55..0b67345 100644
--- a/cppcache/src/ProxyRegion.hpp
+++ b/cppcache/src/ProxyRegion.hpp
@@ -473,8 +473,8 @@ class _GEODE_EXPORT ProxyRegion : public Region {
     throw UnsupportedOperationException("Region.entries()");
   }
 
-  virtual std::shared_ptr<RegionService> getRegionService() const override {
-    return std::shared_ptr<RegionService>(m_proxyCache.get());
+  virtual RegionService& getRegionService() const override {
+    return *m_proxyCache;
   }
 
   virtual bool isDestroyed() const override {

-- 
To stop receiving notification emails like this one, please contact
dgkimura@apache.org.

Mime
View raw message