geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [geode-native] 01/02: GEODE-3651: Convert RegionFactory to value type.
Date Tue, 19 Sep 2017 20:53:05 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 317ee427bc3b4a0f76033b6ac90d81cd7d005b6e
Author: Jacob Barrett <jbarrett@pivotal.io>
AuthorDate: Tue Sep 19 10:29:09 2017 -0700

    GEODE-3651: Convert RegionFactory to value type.
---
 clicache/src/Cache.cpp                             |   4 +-
 clicache/src/RegionFactory.hpp                     |  12 +-
 clicache/src/native_conditional_unique_ptr.hpp     |   3 +
 cppcache/include/geode/Cache.hpp                   |   2 +-
 cppcache/include/geode/RegionFactory.hpp           |  82 ++++++------
 cppcache/integration-test/CacheHelper.cpp          | 146 ++++++++++-----------
 .../integration-test/ThinClientMultipleCaches.hpp  |   2 +-
 .../integration-test/testAttributesFactory.cpp     |  73 ++++-------
 .../integration-test/testOverflowPutGetSqLite.cpp  | 137 +++++--------------
 .../integration-test/testThinClientCqDurable.cpp   |  42 +++---
 cppcache/src/Cache.cpp                             |   2 +-
 cppcache/src/CacheImpl.cpp                         |   5 +-
 cppcache/src/CacheImpl.hpp                         |   2 +-
 cppcache/src/RegionFactory.cpp                     | 103 +++++++--------
 tests/cpp/fwklib/RegionHelper.hpp                  |  80 +++++------
 15 files changed, 296 insertions(+), 399 deletions(-)

diff --git a/clicache/src/Cache.cpp b/clicache/src/Cache.cpp
index 7438e84..3d5d0e1 100644
--- a/clicache/src/Cache.cpp
+++ b/clicache/src/Cache.cpp
@@ -255,7 +255,9 @@ namespace Apache
 
           try
           {
-            return RegionFactory::Create(m_nativeptr->get()->createRegionFactory(preDefineRegionAttr));
+            return RegionFactory::Create(std::unique_ptr<native::RegionFactory>(
+                new native::RegionFactory(
+                    m_nativeptr->get()->createRegionFactory(preDefineRegionAttr))));
           }
           finally
           {
diff --git a/clicache/src/RegionFactory.hpp b/clicache/src/RegionFactory.hpp
index 6e781db..0c15cab 100644
--- a/clicache/src/RegionFactory.hpp
+++ b/clicache/src/RegionFactory.hpp
@@ -427,15 +427,15 @@ namespace Apache
       /// <returns>
       /// The managed wrapper object; null if the native pointer is null.
       /// </returns>
-      inline static RegionFactory^ Create(native::RegionFactoryPtr nativeptr )
+      inline static RegionFactory^ Create(std::unique_ptr<native::RegionFactory>& nativeptr)
       {
           return __nullptr == nativeptr ? nullptr :
             gcnew RegionFactory( nativeptr );
       }
 
-      std::shared_ptr<native::RegionFactory> GetNative()
+      native::RegionFactory& GetNative()
       {
-          return m_nativeptr->get_shared_ptr();
+          return *m_nativeptr;
       }
 
 	  private:
@@ -444,12 +444,12 @@ namespace Apache
         /// Private constructor to wrap a native object pointer
         /// </summary>
         /// <param name="nativeptr">The native object pointer</param>
-      inline RegionFactory(native::RegionFactoryPtr nativeptr )
+      inline RegionFactory(std::unique_ptr<native::RegionFactory>& nativeptr)
       {
-        m_nativeptr = gcnew native_shared_ptr<native::RegionFactory>(nativeptr);
+        m_nativeptr = gcnew native_conditional_unique_ptr<native::RegionFactory>(std::move(nativeptr));
       }
 
-      native_shared_ptr<native::RegionFactory>^ m_nativeptr; 
+      native_conditional_unique_ptr<native::RegionFactory>^ m_nativeptr; 
       };
     }  // namespace Client
   }  // namespace Geode
diff --git a/clicache/src/native_conditional_unique_ptr.hpp b/clicache/src/native_conditional_unique_ptr.hpp
index 395fb29..33fe01d 100644
--- a/clicache/src/native_conditional_unique_ptr.hpp
+++ b/clicache/src/native_conditional_unique_ptr.hpp
@@ -55,6 +55,9 @@ namespace Apache
           return __nullptr == owned_ptr ? unowned_ptr : owned_ptr->get();
         }
 
+        inline _T& operator*() {
+          return *get();
+        }
       };
     }
   }
diff --git a/cppcache/include/geode/Cache.hpp b/cppcache/include/geode/Cache.hpp
index b414d5e..64d9030 100644
--- a/cppcache/include/geode/Cache.hpp
+++ b/cppcache/include/geode/Cache.hpp
@@ -76,7 +76,7 @@ class CPPCACHE_EXPORT Cache : public GeodeCache,
    * @param regionShortcut
    *        To create the region specific type, @see RegionShortcut
    */
-  virtual RegionFactoryPtr createRegionFactory(RegionShortcut regionShortcut);
+  virtual RegionFactory createRegionFactory(RegionShortcut regionShortcut);
 
   /**
    * Initializes the cache from an xml file
diff --git a/cppcache/include/geode/RegionFactory.hpp b/cppcache/include/geode/RegionFactory.hpp
index 52aba8a..bc0774a 100644
--- a/cppcache/include/geode/RegionFactory.hpp
+++ b/cppcache/include/geode/RegionFactory.hpp
@@ -31,9 +31,13 @@ namespace apache {
 namespace geode {
 namespace client {
 class CacheImpl;
-class CPPCACHE_EXPORT RegionFactory
-    : public std::enable_shared_from_this<RegionFactory> {
+class CPPCACHE_EXPORT RegionFactory {
  public:
+  RegionFactory() = delete;
+  ~RegionFactory() = default;
+  RegionFactory(const RegionFactory& move) = delete;
+  RegionFactory(RegionFactory&& move) = default;
+
   /*
    * To create the (@link Region}.
    * @param name
@@ -48,58 +52,58 @@ class CPPCACHE_EXPORT RegionFactory
    * @param cacheLoader the cache loader or nullptr if no loader
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setCacheLoader(const CacheLoaderPtr& cacheLoader);
+  RegionFactory& setCacheLoader(const CacheLoaderPtr& cacheLoader);
 
   /** Sets the cache writer for the next <code>RegionAttributes</code> created.
    * @param cacheWriter the cache writer or nullptr if no cache writer
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setCacheWriter(const CacheWriterPtr& cacheWriter);
+  RegionFactory& setCacheWriter(const CacheWriterPtr& cacheWriter);
 
   /** Sets the CacheListener for the next <code>RegionAttributes</code> created.
    * @param aListener a user defined CacheListener, nullptr if no listener
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setCacheListener(const CacheListenerPtr& aListener);
+  RegionFactory& setCacheListener(const CacheListenerPtr& aListener);
 
   /** Sets the PartitionResolver for the next <code>RegionAttributes</code>
    * created.
    * @param aResolver a user defined PartitionResolver, nullptr if no resolver
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setPartitionResolver(const PartitionResolverPtr& aResolver);
+  RegionFactory& setPartitionResolver(const PartitionResolverPtr& aResolver);
 
   /**
    * Sets the library path for the library that will be invoked for the loader
    * of the region.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setCacheLoader(const char* libpath,
-                                  const char* factoryFuncName);
+  RegionFactory& setCacheLoader(const char* libpath,
+                                const char* factoryFuncName);
 
   /**
    * Sets the library path for the library that will be invoked for the writer
    * of the region.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setCacheWriter(const char* libpath,
-                                  const char* factoryFuncName);
+  RegionFactory& setCacheWriter(const char* libpath,
+                                const char* factoryFuncName);
 
   /**
    * Sets the library path for the library that will be invoked for the listener
    * of the region.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setCacheListener(const char* libpath,
-                                    const char* factoryFuncName);
+  RegionFactory& setCacheListener(const char* libpath,
+                                  const char* factoryFuncName);
 
   /**
    * Sets the library path for the library that will be invoked for the
    * partition resolver of the region.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setPartitionResolver(const char* libpath,
-                                        const char* factoryFuncName);
+  RegionFactory& setPartitionResolver(const char* libpath,
+                                      const char* factoryFuncName);
 
   // EXPIRATION ATTRIBUTES
 
@@ -109,8 +113,8 @@ class CPPCACHE_EXPORT RegionFactory
    * @param idleTimeout the idleTimeout in seconds for entries in this region.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setEntryIdleTimeout(ExpirationAction::Action action,
-                                       int32_t idleTimeout);
+  RegionFactory& setEntryIdleTimeout(ExpirationAction::Action action,
+                                     int32_t idleTimeout);
 
   /** Sets the timeToLive expiration attributes for region entries for the next
    * <code>RegionAttributes</code> created.
@@ -118,8 +122,8 @@ class CPPCACHE_EXPORT RegionFactory
    * @param timeToLive the timeToLive in seconds for entries in this region.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setEntryTimeToLive(ExpirationAction::Action action,
-                                      int32_t timeToLive);
+  RegionFactory& setEntryTimeToLive(ExpirationAction::Action action,
+                                    int32_t timeToLive);
 
   /** Sets the idleTimeout expiration attributes for the region itself for the
    * next <code>RegionAttributes</code> created.
@@ -127,8 +131,8 @@ class CPPCACHE_EXPORT RegionFactory
    * @param idleTimeout the idleTimeout in seconds for the region as a whole.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setRegionIdleTimeout(ExpirationAction::Action action,
-                                        int32_t idleTimeout);
+  RegionFactory& setRegionIdleTimeout(ExpirationAction::Action action,
+                                      int32_t idleTimeout);
 
   /** Sets the timeToLive expiration attributes for the region itself for the
    * next <code>RegionAttributes</code> created.
@@ -136,8 +140,8 @@ class CPPCACHE_EXPORT RegionFactory
    * @param timeToLive the timeToLive in seconds for the region as a whole.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setRegionTimeToLive(ExpirationAction::Action action,
-                                       int32_t timeToLive);
+  RegionFactory& setRegionTimeToLive(ExpirationAction::Action action,
+                                     int32_t timeToLive);
 
   // PERSISTENCE
   /**
@@ -148,9 +152,9 @@ class CPPCACHE_EXPORT RegionFactory
    * this must be used to set the PersistenceManager.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setPersistenceManager(const char* libpath,
-                                         const char* factoryFuncName,
-                                         const PropertiesPtr& config = nullptr);
+  RegionFactory& setPersistenceManager(const char* libpath,
+                                       const char* factoryFuncName,
+                                       const PropertiesPtr& config = nullptr);
 
   /** Sets the PersistenceManager for the next <code>RegionAttributes</code>
    * created.
@@ -158,7 +162,7 @@ class CPPCACHE_EXPORT RegionFactory
    * persistenceManager
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setPersistenceManager(
+  RegionFactory& setPersistenceManager(
       const PersistenceManagerPtr& persistenceManager,
       const PropertiesPtr& config = nullptr);
 
@@ -170,7 +174,7 @@ class CPPCACHE_EXPORT RegionFactory
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if initialCapacity is negative.
    */
-  RegionFactoryPtr setInitialCapacity(int initialCapacity);
+  RegionFactory& setInitialCapacity(int initialCapacity);
 
   /** Sets the entry load factor for the next <code>RegionAttributes</code>
    * created. This value is
@@ -179,7 +183,7 @@ class CPPCACHE_EXPORT RegionFactory
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if loadFactor is nonpositive
    */
-  RegionFactoryPtr setLoadFactor(float loadFactor);
+  RegionFactory& setLoadFactor(float loadFactor);
 
   /** Sets the concurrency level tof the next <code>RegionAttributes</code>
    * created. This value is used in initializing the map that holds the entries.
@@ -187,7 +191,7 @@ class CPPCACHE_EXPORT RegionFactory
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if concurrencyLevel is nonpositive
    */
-  RegionFactoryPtr setConcurrencyLevel(uint8_t concurrencyLevel);
+  RegionFactory& setConcurrencyLevel(uint8_t concurrencyLevel);
 
   /**
    * Sets a limit on the number of entries that will be held in the cache.
@@ -197,7 +201,7 @@ class CPPCACHE_EXPORT RegionFactory
    * @param entriesLimit number of enteries to keep in region
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setLruEntriesLimit(const uint32_t entriesLimit);
+  RegionFactory& setLruEntriesLimit(const uint32_t entriesLimit);
 
   /** Sets the Disk policy type for the next <code>RegionAttributes</code>
    * created.
@@ -205,7 +209,7 @@ class CPPCACHE_EXPORT RegionFactory
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if diskPolicyType is Invalid
    */
-  RegionFactoryPtr setDiskPolicy(const DiskPolicyType::PolicyType diskPolicy);
+  RegionFactory& setDiskPolicy(const DiskPolicyType::PolicyType diskPolicy);
 
   /**
    * Set caching enabled flag for this region. If set to false, then no data is
@@ -218,7 +222,7 @@ class CPPCACHE_EXPORT RegionFactory
    * @param cachingEnabled if true, cache data for this region in this process.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setCachingEnabled(bool cachingEnabled);
+  RegionFactory& setCachingEnabled(bool cachingEnabled);
 
   /*
    * Set the PoolName to attach the Region with that Pool.
@@ -227,14 +231,14 @@ class CPPCACHE_EXPORT RegionFactory
    *        the name of the Pool to which region will be attached.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setPoolName(const char* name);
+  RegionFactory& setPoolName(const char* name);
 
   /*
    * Set boolean to enable/disable cloning while applying delta.
    * @param isClonable whether to enable cloning or not.
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setCloningEnabled(bool isClonable);
+  RegionFactory& setCloningEnabled(bool isClonable);
 
   /**
    * Enables or disables concurrent modification checks
@@ -243,7 +247,7 @@ class CPPCACHE_EXPORT RegionFactory
    * operations
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setConcurrencyChecksEnabled(bool enable);
+  RegionFactory& setConcurrencyChecksEnabled(bool enable);
 
   /**
    * Sets time out for tombstones
@@ -251,21 +255,21 @@ class CPPCACHE_EXPORT RegionFactory
    * @param tombstoneTimeoutInMSec tombstone timeout in milli second
    * @return a reference to <code>this</code>
    */
-  RegionFactoryPtr setTombstoneTimeout(uint32_t tombstoneTimeoutInMSec);
+  RegionFactory& setTombstoneTimeout(uint32_t tombstoneTimeoutInMSec);
 
  private:
   RegionFactory(apache::geode::client::RegionShortcut preDefinedRegion,
                 CacheImpl* cacheImpl);
 
+  void setRegionShortcut();
+
   RegionShortcut m_preDefinedRegion;
 
   AttributesFactoryPtr m_attributeFactory;
 
-  void setRegionShortcut();
   CacheImpl* m_cacheImpl;
-  ~RegionFactory();
+
   friend class CacheImpl;
-  FRIEND_STD_SHARED_PTR(RegionFactory)
 };
 }  // namespace client
 }  // namespace geode
diff --git a/cppcache/integration-test/CacheHelper.cpp b/cppcache/integration-test/CacheHelper.cpp
index df345b2..d47df91 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -89,9 +89,8 @@ CacheHelper::CacheHelper(const char* member_id, const PropertiesPtr& configPtr,
   if (noRootRegion) return;
 
   try {
-    RegionFactoryPtr regionFactoryPtr =
-        cachePtr->createRegionFactory(CACHING_PROXY);
-    rootRegionPtr = regionFactoryPtr->create(ROOT_NAME);
+    auto regionFactory = cachePtr->createRegionFactory(CACHING_PROXY);
+    rootRegionPtr = regionFactory.create(ROOT_NAME);
   } catch (const RegionExistsException&) {
     rootRegionPtr = cachePtr->getRegion(ROOT_NAME);
   }
@@ -134,9 +133,8 @@ CacheHelper::CacheHelper(const PropertiesPtr& configPtr,
   if (noRootRegion) return;
 
   try {
-    RegionFactoryPtr regionFactoryPtr =
-        cachePtr->createRegionFactory(CACHING_PROXY);
-    rootRegionPtr = regionFactoryPtr->create(ROOT_NAME);
+    auto regionFactory = cachePtr->createRegionFactory(CACHING_PROXY);
+    rootRegionPtr = regionFactory.create(ROOT_NAME);
   } catch (const RegionExistsException&) {
     rootRegionPtr = cachePtr->getRegion(ROOT_NAME);
   }
@@ -526,16 +524,16 @@ RegionPtr CacheHelper::createRegionAndAttachPool(
   if (lel > 0) {
     preDefRA = CACHING_PROXY_ENTRY_LRU;
   }
-  RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(preDefRA);
-  regionFactoryPtr->setLruEntriesLimit(lel);
-  regionFactoryPtr->setEntryIdleTimeout(action, eit);
-  regionFactoryPtr->setEntryTimeToLive(action, ettl);
-  regionFactoryPtr->setRegionIdleTimeout(action, rit);
-  regionFactoryPtr->setRegionTimeToLive(action, rttl);
+  auto regionFactory = cachePtr->createRegionFactory(preDefRA);
+  regionFactory.setLruEntriesLimit(lel);
+  regionFactory.setEntryIdleTimeout(action, eit);
+  regionFactory.setEntryTimeToLive(action, ettl);
+  regionFactory.setRegionIdleTimeout(action, rit);
+  regionFactory.setRegionTimeToLive(action, rttl);
   if (poolName != nullptr) {
-    regionFactoryPtr->setPoolName(poolName);
+    regionFactory.setPoolName(poolName);
   }
-  return regionFactoryPtr->create(name);
+  return regionFactory.create(name);
 }
 
 RegionPtr CacheHelper::createRegionAndAttachPool2(
@@ -549,15 +547,15 @@ RegionPtr CacheHelper::createRegionAndAttachPool2(
   if (lel > 0) {
     preDefRA = CACHING_PROXY_ENTRY_LRU;
   }
-  RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(preDefRA);
-  regionFactoryPtr->setLruEntriesLimit(lel);
-  regionFactoryPtr->setEntryIdleTimeout(action, eit);
-  regionFactoryPtr->setEntryTimeToLive(action, ettl);
-  regionFactoryPtr->setRegionIdleTimeout(action, rit);
-  regionFactoryPtr->setRegionTimeToLive(action, rttl);
-  regionFactoryPtr->setPoolName(poolName);
-  regionFactoryPtr->setPartitionResolver(aResolver);
-  return regionFactoryPtr->create(name);
+  auto regionFactory = cachePtr->createRegionFactory(preDefRA);
+  regionFactory.setLruEntriesLimit(lel);
+  regionFactory.setEntryIdleTimeout(action, eit);
+  regionFactory.setEntryTimeToLive(action, ettl);
+  regionFactory.setRegionIdleTimeout(action, rit);
+  regionFactory.setRegionTimeToLive(action, rttl);
+  regionFactory.setPoolName(poolName);
+  regionFactory.setPartitionResolver(aResolver);
+  return regionFactory.create(name);
 }
 
 void CacheHelper::addServerLocatorEPs(const char* epList, PoolFactoryPtr pfPtr,
@@ -628,17 +626,17 @@ RegionPtr CacheHelper::createPooledRegion(
   if (lel > 0) {
     preDefRA = CACHING_PROXY_ENTRY_LRU;
   }
-  RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(preDefRA);
-  regionFactoryPtr->setLruEntriesLimit(lel);
-  regionFactoryPtr->setEntryIdleTimeout(action, eit);
-  regionFactoryPtr->setEntryTimeToLive(action, ettl);
-  regionFactoryPtr->setRegionIdleTimeout(action, rit);
-  regionFactoryPtr->setRegionTimeToLive(action, rttl);
-  regionFactoryPtr->setPoolName(poolName);
+  auto regionFactory = cachePtr->createRegionFactory(preDefRA);
+  regionFactory.setLruEntriesLimit(lel);
+  regionFactory.setEntryIdleTimeout(action, eit);
+  regionFactory.setEntryTimeToLive(action, ettl);
+  regionFactory.setRegionIdleTimeout(action, rit);
+  regionFactory.setRegionTimeToLive(action, rttl);
+  regionFactory.setPoolName(poolName);
   if (cacheListener != nullptr) {
-    regionFactoryPtr->setCacheListener(cacheListener);
+    regionFactory.setCacheListener(cacheListener);
   }
-  return regionFactoryPtr->create(name);
+  return regionFactory.create(name);
 }
 
 RegionPtr CacheHelper::createPooledRegionConcurrencyCheckDisabled(
@@ -664,18 +662,18 @@ RegionPtr CacheHelper::createPooledRegionConcurrencyCheckDisabled(
   if (lel > 0) {
     preDefRA = CACHING_PROXY_ENTRY_LRU;
   }
-  RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(preDefRA);
-  regionFactoryPtr->setLruEntriesLimit(lel);
-  regionFactoryPtr->setEntryIdleTimeout(action, eit);
-  regionFactoryPtr->setEntryTimeToLive(action, ettl);
-  regionFactoryPtr->setRegionIdleTimeout(action, rit);
-  regionFactoryPtr->setRegionTimeToLive(action, rttl);
-  regionFactoryPtr->setConcurrencyChecksEnabled(concurrencyCheckEnabled);
-  regionFactoryPtr->setPoolName(poolName);
+  auto regionFactory = cachePtr->createRegionFactory(preDefRA);
+  regionFactory.setLruEntriesLimit(lel);
+  regionFactory.setEntryIdleTimeout(action, eit);
+  regionFactory.setEntryTimeToLive(action, ettl);
+  regionFactory.setRegionIdleTimeout(action, rit);
+  regionFactory.setRegionTimeToLive(action, rttl);
+  regionFactory.setConcurrencyChecksEnabled(concurrencyCheckEnabled);
+  regionFactory.setPoolName(poolName);
   if (cacheListener != nullptr) {
-    regionFactoryPtr->setCacheListener(cacheListener);
+    regionFactory.setCacheListener(cacheListener);
   }
-  return regionFactoryPtr->create(name);
+  return regionFactory.create(name);
 }
 
 RegionPtr CacheHelper::createRegionDiscOverFlow(
@@ -737,30 +735,30 @@ RegionPtr CacheHelper::createPooledRegionDiscOverFlow(
   if (lel > 0) {
     preDefRA = CACHING_PROXY_ENTRY_LRU;
   }
-  RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(preDefRA);
-  regionFactoryPtr->setLruEntriesLimit(lel);
-  regionFactoryPtr->setEntryIdleTimeout(action, eit);
-  regionFactoryPtr->setEntryTimeToLive(action, ettl);
-  regionFactoryPtr->setRegionIdleTimeout(action, rit);
-  regionFactoryPtr->setRegionTimeToLive(action, rttl);
-  regionFactoryPtr->setPoolName(poolName);
-  regionFactoryPtr->setCloningEnabled(true);
+  auto regionFactory = cachePtr->createRegionFactory(preDefRA);
+  regionFactory.setLruEntriesLimit(lel);
+  regionFactory.setEntryIdleTimeout(action, eit);
+  regionFactory.setEntryTimeToLive(action, ettl);
+  regionFactory.setRegionIdleTimeout(action, rit);
+  regionFactory.setRegionTimeToLive(action, rttl);
+  regionFactory.setPoolName(poolName);
+  regionFactory.setCloningEnabled(true);
   if (lel > 0) {
-    regionFactoryPtr->setDiskPolicy(DiskPolicyType::OVERFLOWS);
-    PropertiesPtr sqLiteProps = Properties::create();
+    regionFactory.setDiskPolicy(DiskPolicyType::OVERFLOWS);
+    auto sqLiteProps = Properties::create();
     sqLiteProps->insert("PageSize", "65536");
     sqLiteProps->insert("MaxPageCount", "1073741823");
     std::string sqlite_dir =
         "SqLiteRegionData" +
         std::to_string(static_cast<long long int>(ACE_OS::getpid()));
     sqLiteProps->insert("PersistenceDirectory", sqlite_dir.c_str());
-    regionFactoryPtr->setPersistenceManager(
-        "SqLiteImpl", "createSqLiteInstance", sqLiteProps);
+    regionFactory.setPersistenceManager("SqLiteImpl", "createSqLiteInstance",
+                                        sqLiteProps);
   }
   if (cacheListener != nullptr) {
-    regionFactoryPtr->setCacheListener(cacheListener);
+    regionFactory.setCacheListener(cacheListener);
   }
-  return regionFactoryPtr->create(name);
+  return regionFactory.create(name);
 }
 
 RegionPtr CacheHelper::createPooledRegionSticky(
@@ -790,17 +788,17 @@ RegionPtr CacheHelper::createPooledRegionSticky(
   if (lel > 0) {
     preDefRA = CACHING_PROXY_ENTRY_LRU;
   }
-  RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(preDefRA);
-  regionFactoryPtr->setLruEntriesLimit(lel);
-  regionFactoryPtr->setEntryIdleTimeout(action, eit);
-  regionFactoryPtr->setEntryTimeToLive(action, ettl);
-  regionFactoryPtr->setRegionIdleTimeout(action, rit);
-  regionFactoryPtr->setRegionTimeToLive(action, rttl);
-  regionFactoryPtr->setPoolName(poolName);
+  auto regionFactory = cachePtr->createRegionFactory(preDefRA);
+  regionFactory.setLruEntriesLimit(lel);
+  regionFactory.setEntryIdleTimeout(action, eit);
+  regionFactory.setEntryTimeToLive(action, ettl);
+  regionFactory.setRegionIdleTimeout(action, rit);
+  regionFactory.setRegionTimeToLive(action, rttl);
+  regionFactory.setPoolName(poolName);
   if (cacheListener != nullptr) {
-    regionFactoryPtr->setCacheListener(cacheListener);
+    regionFactory.setCacheListener(cacheListener);
   }
-  return regionFactoryPtr->create(name);
+  return regionFactory.create(name);
 }
 
 RegionPtr CacheHelper::createPooledRegionStickySingleHop(
@@ -830,17 +828,17 @@ RegionPtr CacheHelper::createPooledRegionStickySingleHop(
   if (lel > 0) {
     preDefRA = CACHING_PROXY_ENTRY_LRU;
   }
-  RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(preDefRA);
-  regionFactoryPtr->setLruEntriesLimit(lel);
-  regionFactoryPtr->setEntryIdleTimeout(action, eit);
-  regionFactoryPtr->setEntryTimeToLive(action, ettl);
-  regionFactoryPtr->setRegionIdleTimeout(action, rit);
-  regionFactoryPtr->setRegionTimeToLive(action, rttl);
-  regionFactoryPtr->setPoolName(poolName);
+  auto regionFactory = cachePtr->createRegionFactory(preDefRA);
+  regionFactory.setLruEntriesLimit(lel);
+  regionFactory.setEntryIdleTimeout(action, eit);
+  regionFactory.setEntryTimeToLive(action, ettl);
+  regionFactory.setRegionIdleTimeout(action, rit);
+  regionFactory.setRegionTimeToLive(action, rttl);
+  regionFactory.setPoolName(poolName);
   if (cacheListener != nullptr) {
-    regionFactoryPtr->setCacheListener(cacheListener);
+    regionFactory.setCacheListener(cacheListener);
   }
-  return regionFactoryPtr->create(name);
+  return regionFactory.create(name);
 }
 
 RegionPtr CacheHelper::createSubregion(RegionPtr& parent, const char* name,
diff --git a/cppcache/integration-test/ThinClientMultipleCaches.hpp b/cppcache/integration-test/ThinClientMultipleCaches.hpp
index 9b33e45..637b368 100644
--- a/cppcache/integration-test/ThinClientMultipleCaches.hpp
+++ b/cppcache/integration-test/ThinClientMultipleCaches.hpp
@@ -53,7 +53,7 @@ RegionPtr createRegionFromCache(std::shared_ptr<Cache> cache) {
   auto poolFactory = cache->getPoolManager().createFactory();
   CacheHelper::getHelper().addServerLocatorEPs(locatorsG, poolFactory, true);
   poolFactory->create("DistRegionAck");
-  return cache->createRegionFactory(PROXY)->create("DistRegionAck");
+  return cache->createRegionFactory(PROXY).create("DistRegionAck");
 }
 
 DUNIT_TASK_DEFINITION(CLIENT1, SetupAndTestMutlipleCaches)
diff --git a/cppcache/integration-test/testAttributesFactory.cpp b/cppcache/integration-test/testAttributesFactory.cpp
index 2e4ffcf..ef84c40 100644
--- a/cppcache/integration-test/testAttributesFactory.cpp
+++ b/cppcache/integration-test/testAttributesFactory.cpp
@@ -23,79 +23,62 @@
 
 using namespace apache::geode::client;
 
-// BEGIN_TEST(ATTRIBUTE_FACTORY)
-//  {
-//    AttributesFactory af;
-//    RegionAttributesPtr ra;
-//    RegionPtr region;
-//
-//    CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory();
-//    CachePtr cache = cacheFactoryPtr->create();
-//    ra = af.createRegionAttributes();
-//
-//    CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
-//    cacheImpl->createRegion("region1", ra, region);
-//    LOG("local region created with HA cache specification.");
-//    cache->close();
-//  }
-// END_TEST(ATTRIBUTE_FACTORY)
-
 /* testing attributes with invalid value */
 /* testing with negative values */          /*see bug no #865 */
 /* testing with exceed boundry condition */ /*see bug no #865 */
 BEGIN_TEST(REGION_FACTORY)
   {
-    CacheFactoryPtr cf = CacheFactory::createCacheFactory();
-    CachePtr m_cache = cf->create();
+    auto cf = CacheFactory::createCacheFactory();
+    auto cache = cf->create();
 
-    RegionFactoryPtr rf = m_cache->createRegionFactory(LOCAL);
+    auto rf = cache->createRegionFactory(LOCAL);
     /*see bug no #865 */
     try {
-      rf->setInitialCapacity(-1);
+      rf.setInitialCapacity(-1);
       FAIL("Should have got expected IllegalArgumentException");
     } catch (IllegalArgumentException&) {
       LOG("Got expected IllegalArgumentException");
     }
 
-    RegionPtr m_region = rf->create("Local_ETTL_LI");
-    LOGINFO("m_region->getAttributes()->getInitialCapacity() = %d ",
-            m_region->getAttributes()->getInitialCapacity());
-    ASSERT(m_region->getAttributes()->getInitialCapacity() == 10000,
+    auto region = rf.create("Local_ETTL_LI");
+    LOGINFO("region->getAttributes()->getInitialCapacity() = %d ",
+            region->getAttributes()->getInitialCapacity());
+    ASSERT(region->getAttributes()->getInitialCapacity() == 10000,
            "Incorrect InitialCapacity");
 
-    m_region->put(1, 1);
-    auto res = std::dynamic_pointer_cast<CacheableInt32>(m_region->get(1));
+    region->put(1, 1);
+    auto res = std::dynamic_pointer_cast<CacheableInt32>(region->get(1));
     ASSERT(res->value() == 1, "Expected to find value 1.");
 
-    m_region->destroyRegion();
-    m_cache->close();
-    m_cache = nullptr;
-    m_region = nullptr;
+    region->destroyRegion();
+    cache->close();
+    cache = nullptr;
+    region = nullptr;
 
-    CacheFactoryPtr cf1 = CacheFactory::createCacheFactory();
-    CachePtr m_cache1 = cf1->create();
+    auto cf1 = CacheFactory::createCacheFactory();
+    auto cache1 = cf1->create();
 
-    RegionFactoryPtr rf1 = m_cache1->createRegionFactory(LOCAL);
+    auto rf1 = cache1->createRegionFactory(LOCAL);
     /*see bug no #865 */
     try {
-      rf1->setInitialCapacity(2147483648U);
+      rf1.setInitialCapacity(2147483648U);
       FAIL("Should have got expected IllegalArgumentException");
     } catch (IllegalArgumentException&) {
       LOG("Got expected IllegalArgumentException");
     }
-    RegionPtr m_region1 = rf1->create("Local_ETTL_LI");
-    LOGINFO("m_region1->getAttributes()->getInitialCapacity() = %d ",
-            m_region1->getAttributes()->getInitialCapacity());
-    ASSERT(m_region1->getAttributes()->getInitialCapacity() == 10000,
+    auto region1 = rf1.create("Local_ETTL_LI");
+    LOGINFO("region1->getAttributes()->getInitialCapacity() = %d ",
+            region1->getAttributes()->getInitialCapacity());
+    ASSERT(region1->getAttributes()->getInitialCapacity() == 10000,
            "Incorrect InitialCapacity");
 
-    m_region1->put(1, 1);
-    auto res1 = std::dynamic_pointer_cast<CacheableInt32>(m_region1->get(1));
+    region1->put(1, 1);
+    auto res1 = std::dynamic_pointer_cast<CacheableInt32>(region1->get(1));
     ASSERT(res1->value() == 1, "Expected to find value 1.");
 
-    m_region1->destroyRegion();
-    m_cache1->close();
-    m_cache1 = nullptr;
-    m_region1 = nullptr;
+    region1->destroyRegion();
+    cache1->close();
+    cache1 = nullptr;
+    region1 = nullptr;
   }
 END_TEST(REGION_FACTORY)
diff --git a/cppcache/integration-test/testOverflowPutGetSqLite.cpp b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
index 7467539..5fc7cfc 100644
--- a/cppcache/integration-test/testOverflowPutGetSqLite.cpp
+++ b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
@@ -308,18 +308,17 @@ void verifyGetAll(RegionPtr region, int startIndex) {
 
 void createRegion(RegionPtr& regionPtr, const char* regionName,
                   PropertiesPtr& cacheProps, PropertiesPtr& sqLiteProps) {
-  CacheFactoryPtr cacheFactoryPtr =
-      CacheFactory::createCacheFactory(cacheProps);
-  CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
+  auto cacheFactoryPtr = CacheFactory::createCacheFactory(cacheProps);
+  auto cachePtr = CacheFactory::createCacheFactory()->create();
   ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
-  RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(LOCAL);
-  regionFactoryPtr->setCachingEnabled(true);
-  regionFactoryPtr->setLruEntriesLimit(10);
-  regionFactoryPtr->setInitialCapacity(1000);
-  regionFactoryPtr->setDiskPolicy(DiskPolicyType::OVERFLOWS);
-  regionFactoryPtr->setPersistenceManager("SqLiteImpl", "createSqLiteInstance",
-                                          sqLiteProps);
-  regionPtr = regionFactoryPtr->create(regionName);
+  auto regionFactory = cachePtr->createRegionFactory(LOCAL);
+  regionFactory.setCachingEnabled(true);
+  regionFactory.setLruEntriesLimit(10);
+  regionFactory.setInitialCapacity(1000);
+  regionFactory.setDiskPolicy(DiskPolicyType::OVERFLOWS);
+  regionFactory.setPersistenceManager("SqLiteImpl", "createSqLiteInstance",
+                                      sqLiteProps);
+  regionPtr = regionFactory.create(regionName);
   ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-nullptr");
 }
 
@@ -471,22 +470,22 @@ END_TEST(OverFlowTest_absPath)
 
 BEGIN_TEST(OverFlowTest_SqLiteFull)
   {
-    CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory();
-    CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
+    auto cacheFactoryPtr = CacheFactory::createCacheFactory();
+    auto cachePtr = CacheFactory::createCacheFactory()->create();
     ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
-    RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(LOCAL);
-    regionFactoryPtr->setCachingEnabled(true);
-    regionFactoryPtr->setLruEntriesLimit(1);
-    regionFactoryPtr->setInitialCapacity(1000);
-    regionFactoryPtr->setDiskPolicy(DiskPolicyType::OVERFLOWS);
-    PropertiesPtr sqliteProperties = Properties::create();
+    auto regionFactory = cachePtr->createRegionFactory(LOCAL);
+    regionFactory.setCachingEnabled(true);
+    regionFactory.setLruEntriesLimit(1);
+    regionFactory.setInitialCapacity(1000);
+    regionFactory.setDiskPolicy(DiskPolicyType::OVERFLOWS);
+    auto sqliteProperties = Properties::create();
     sqliteProperties->insert(
         "MaxPageCount", "10");  // 10 * 1024 is arround 10kB is the db file size
     sqliteProperties->insert("PageSize", "1024");
     sqliteProperties->insert("PersistenceDirectory", sqlite_dir.c_str());
-    regionFactoryPtr->setPersistenceManager(
-        "SqLiteImpl", "createSqLiteInstance", sqliteProperties);
-    RegionPtr regionPtr = regionFactoryPtr->create("OverFlowRegion");
+    regionFactory.setPersistenceManager("SqLiteImpl", "createSqLiteInstance",
+                                        sqliteProperties);
+    auto regionPtr = regionFactory.create("OverFlowRegion");
     ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-nullptr");
 
     try {
@@ -507,100 +506,30 @@ BEGIN_TEST(OverFlowTest_SqLiteFull)
   }
 END_TEST(OverFlowTest_SqLiteFull)
 
-//#if ( defined(_WIN64) || defined(__sparcv9) || defined(__x86_64__) ) // run
-// this test only for 64 bit mode
-// BEGIN_TEST(OverFlowTest_LargeData)
-//{
-//  /** Connecting to a distributed system. */
-//  DistributedSystem& dsysPtr;
-//
-//  /** Creating a cache to manage regions. */
-//  CachePtr cachePtr ;
-//  PropertiesPtr pp = Properties::create();
-//  startDSandCreateCache(dsysPtr, cachePtr, pp);
-//  ASSERT(dsysPtr != nullptr, "Expected dsys to be NON-nullptr");
-//  ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
-//
-//  RegionAttributesPtr attrsPtr;
-//  AttributesFactory attrsFact;
-//  attrsFact.setCachingEnabled(true);
-//  attrsFact.setLruEntriesLimit(1 );
-//  attrsFact.setInitialCapacity( 10000 );
-//  attrsFact.setDiskPolicy(DiskPolicyType::OVERFLOWS);
-//  PropertiesPtr sqliteProperties = Properties::create();
-//  sqliteProperties->insert("MaxPageCount","2147483646");  //maximum allowed
-//  for sqlite
-//  sqliteProperties->insert("PageSize","65536"); //maximum allowed for sqlite
-//  sqliteProperties->insert("PersistenceDirectory", sqlite_dir.c_str());
-//  attrsFact.setPersistenceManager("SqLiteImpl","createSqLiteInstance",sqliteProperties);
-//
-//  attrsPtr = attrsFact.createRegionAttributes( );
-//  ASSERT(attrsPtr != nullptr, "Expected region attributes to be NON-nullptr");
-//
-//  /** Create a region with caching and LRU. */
-//  RegionPtr regionPtr = cachePtr->createRegion( "OverFlowRegion", attrsPtr );
-//  ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-nullptr");
-//
-//  /** put one million values into the cache.  to test the large data values*/
-//  doNputLargeData(regionPtr, 1024 * 1); //arround 100 GB data
-//
-//  /** do some gets... printing what we find in the cache. */
-//  doNgetLargeData(regionPtr, 1024 * 1); //arround 100 GB data
-//  LOG("Completed doNget");
-//
-//
-//  /** test to verify same region repeatedly to ensure that the persistece
-//  files are created and destroyed correctly */
-//
-//  RegionPtr subRegion;
-//  for(int i = 0; i<10; i++)
-//  {
-//    createSubRegion(regionPtr,subRegion,attrsPtr,"SubRegion");
-//    ASSERT(subRegion != nullptr, "Expected region to be NON-nullptr");
-//    subRegion->destroyRegion();
-//    ASSERT(subRegion->isDestroyed(), "Expected region is not destroyed ");
-//    subRegion = nullptr;
-//    ACE_TCHAR hname[MAXHOSTNAMELEN];
-//    ACE_OS::hostname( hname, sizeof(hname)-1);
-//    char sqliteDirSubRgn[512];
-//    sprintf(sqliteDirSubRgn, "%s/%s_%u/_%s_SubRegion/file_0.db",
-//        sqlite_dir.c_str(), hname, ACE_OS::getpid(), regionPtr->getName());
-//
-//    ACE_stat fileStat;
-//    ASSERT(ACE_OS::stat(sqliteDirSubRgn, &fileStat) == -1, "persistence file
-//    still present");
-//  }
-//  // cache close
-//  cachePtr->close();
-//  // DS system close
-//  dsysPtr->disconnect();
-//}
-// END_TEST(OverFlowTest_LargeData)
-//#endif // 64-bit
 
 BEGIN_TEST(OverFlowTest_HeapLRU)
   {
     /** Creating a cache to manage regions. */
-    PropertiesPtr pp = Properties::create();
+    auto pp = Properties::create();
     pp->insert("heap-lru-limit", 1);
     pp->insert("heap-lru-delta", 10);
-    CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory(pp);
-    CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
+    auto cacheFactoryPtr = CacheFactory::createCacheFactory(pp);
+    auto cachePtr = CacheFactory::createCacheFactory()->create();
     ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
-    RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(LOCAL);
-    regionFactoryPtr->setCachingEnabled(true);
-    regionFactoryPtr->setLruEntriesLimit(1024 * 10);
-    regionFactoryPtr->setInitialCapacity(1000);
-    regionFactoryPtr->setDiskPolicy(DiskPolicyType::OVERFLOWS);
-    PropertiesPtr sqliteProperties = Properties::create();
+    auto regionFactory = cachePtr->createRegionFactory(LOCAL);
+    regionFactory.setCachingEnabled(true);
+    regionFactory.setLruEntriesLimit(1024 * 10);
+    regionFactory.setInitialCapacity(1000);
+    regionFactory.setDiskPolicy(DiskPolicyType::OVERFLOWS);
+    auto sqliteProperties = Properties::create();
     sqliteProperties->insert(
         "MaxPageCount",
         "2147483646");  // 10 * 1024 is arround 10kB is the db file size
     sqliteProperties->insert("PageSize", "65536");
     sqliteProperties->insert("PersistenceDirectory", sqlite_dir.c_str());
-    regionFactoryPtr->setPersistenceManager(
-        "SqLiteImpl", "createSqLiteInstance", sqliteProperties);
-    RegionPtr regionPtr = regionFactoryPtr->create("OverFlowRegion");
+    regionFactory.setPersistenceManager("SqLiteImpl", "createSqLiteInstance",
+                                        sqliteProperties);
+    auto regionPtr = regionFactory.create("OverFlowRegion");
     ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-nullptr");
 
     validateAttribute(regionPtr);
diff --git a/cppcache/integration-test/testThinClientCqDurable.cpp b/cppcache/integration-test/testThinClientCqDurable.cpp
index 35c3892..48cd2ab 100644
--- a/cppcache/integration-test/testThinClientCqDurable.cpp
+++ b/cppcache/integration-test/testThinClientCqDurable.cpp
@@ -186,13 +186,13 @@ void stepOne() {
 
 void RunDurableCqClient() {
   // Create durable client's properties using api.
-  PropertiesPtr pp = Properties::create();
+  auto pp = Properties::create();
   pp->insert("durable-client-id", "DurableClientId");
   pp->insert("durable-timeout", 3600);
 
   // Create a Geode Cache Programmatically.
-  CacheFactoryPtr cacheFactory = CacheFactory::createCacheFactory(pp);
-  CachePtr cachePtr = cacheFactory->create();
+  auto cacheFactory = CacheFactory::createCacheFactory(pp);
+  auto cachePtr = cacheFactory->create();
   auto poolFactory = cachePtr->getPoolManager().createFactory();
   poolFactory->setSubscriptionEnabled(true);
   poolFactory->setSubscriptionAckInterval(5000);
@@ -201,27 +201,27 @@ void RunDurableCqClient() {
 
   LOGINFO("Created the Geode Cache Programmatically");
 
-  RegionFactoryPtr regionFactory = cachePtr->createRegionFactory(CACHING_PROXY);
+  auto regionFactory = cachePtr->createRegionFactory(CACHING_PROXY);
 
   // Create the Region Programmatically.
-  RegionPtr regionPtr = regionFactory->create("DistRegionAck");
+  auto regionPtr = regionFactory.create("DistRegionAck");
 
   LOGINFO("Created the Region Programmatically");
 
   // Get the QueryService from the Cache.
-  QueryServicePtr qrySvcPtr = cachePtr->getQueryService();
+  auto qrySvcPtr = cachePtr->getQueryService();
 
   // Create CqAttributes and Install Listener
   CqAttributesFactory cqFac;
   auto cqLstner = std::make_shared<MyCqListener1>();
   cqFac.addCqListener(cqLstner);
-  CqAttributesPtr cqAttr = cqFac.create();
+  auto cqAttr = cqFac.create();
 
   LOGINFO("Attached CqListener");
 
   // create a new Cq Query
   const char* qryStr = "select * from /DistRegionAck ";
-  CqQueryPtr qry = qrySvcPtr->newCq((char*)"MyCq", qryStr, cqAttr, true);
+  auto qry = qrySvcPtr->newCq((char*)"MyCq", qryStr, cqAttr, true);
 
   LOGINFO("Created new CqQuery");
 
@@ -251,26 +251,25 @@ void RunDurableCqClient() {
 }
 
 void RunFeederClient() {
-  CacheFactoryPtr cacheFactory = CacheFactory::createCacheFactory();
+  auto cacheFactory = CacheFactory::createCacheFactory();
   LOGINFO("Feeder connected to the Geode Distributed System");
 
-  CachePtr cachePtr = cacheFactory->create();
+  auto cachePtr = cacheFactory->create();
 
   LOGINFO("Created the Geode Cache");
 
-  RegionFactoryPtr regionFactory = cachePtr->createRegionFactory(PROXY);
+  auto regionFactory = cachePtr->createRegionFactory(PROXY);
 
   LOGINFO("Created the RegionFactory");
 
   // Create the Region Programmatically.
-  RegionPtr regionPtr = regionFactory->create("DistRegionAck");
+  auto regionPtr = regionFactory.create("DistRegionAck");
 
   LOGINFO("Created the Region Programmatically.");
 
   for (int i = 0; i < 10; i++) {
-    auto keyPtr =
-        std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
-    CacheableInt32Ptr valPtr = CacheableInt32::create(i);
+    auto keyPtr = CacheableInt32::create(i);
+    auto valPtr = CacheableInt32::create(i);
 
     regionPtr->put(keyPtr, valPtr);
   }
@@ -284,26 +283,25 @@ void RunFeederClient() {
 }
 
 void RunFeederClient1() {
-  CacheFactoryPtr cacheFactory = CacheFactory::createCacheFactory();
+  auto cacheFactory = CacheFactory::createCacheFactory();
   LOGINFO("Feeder connected to the Geode Distributed System");
 
-  CachePtr cachePtr = cacheFactory->create();
+  auto cachePtr = cacheFactory->create();
 
   LOGINFO("Created the Geode Cache");
 
-  RegionFactoryPtr regionFactory = cachePtr->createRegionFactory(PROXY);
+  auto regionFactory = cachePtr->createRegionFactory(PROXY);
 
   LOGINFO("Created the RegionFactory");
 
   // Create the Region Programmatically.
-  RegionPtr regionPtr = regionFactory->create("DistRegionAck");
+  auto regionPtr = regionFactory.create("DistRegionAck");
 
   LOGINFO("Created the Region Programmatically.");
 
   for (int i = 10; i < 20; i++) {
-    auto keyPtr =
-        std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
-    CacheableInt32Ptr valPtr = CacheableInt32::create(i);
+    auto keyPtr = CacheableInt32::create(i);
+    auto valPtr = CacheableInt32::create(i);
 
     regionPtr->put(keyPtr, valPtr);
   }
diff --git a/cppcache/src/Cache.cpp b/cppcache/src/Cache.cpp
index 37ca223..bbd7c18 100644
--- a/cppcache/src/Cache.cpp
+++ b/cppcache/src/Cache.cpp
@@ -132,7 +132,7 @@ void Cache::rootRegions(VectorOfRegion& regions) {
    }*/
 }
 
-RegionFactoryPtr Cache::createRegionFactory(RegionShortcut preDefinedRegion) {
+RegionFactory Cache::createRegionFactory(RegionShortcut preDefinedRegion) {
   return m_cacheImpl->createRegionFactory(preDefinedRegion);
 }
 
diff --git a/cppcache/src/CacheImpl.cpp b/cppcache/src/CacheImpl.cpp
index a7c5157..e4acce7 100644
--- a/cppcache/src/CacheImpl.cpp
+++ b/cppcache/src/CacheImpl.cpp
@@ -739,9 +739,8 @@ int CacheImpl::getPoolSize(const char* poolName) {
   return -1;
 }
 
-RegionFactoryPtr CacheImpl::createRegionFactory(
-    RegionShortcut preDefinedRegion) {
-  return std::make_shared<RegionFactory>(preDefinedRegion, this);
+RegionFactory CacheImpl::createRegionFactory(RegionShortcut preDefinedRegion) {
+  return RegionFactory(preDefinedRegion, this);
 }
 
 std::map<std::string, RegionAttributesPtr> CacheImpl::getRegionShortcut() {
diff --git a/cppcache/src/CacheImpl.hpp b/cppcache/src/CacheImpl.hpp
index e6da435..fec3a9f 100644
--- a/cppcache/src/CacheImpl.hpp
+++ b/cppcache/src/CacheImpl.hpp
@@ -203,7 +203,7 @@ class CPPCACHE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
    */
   inline void setSearchTimeout(int seconds = 0) {}
 
-  virtual RegionFactoryPtr createRegionFactory(RegionShortcut preDefinedRegion);
+  virtual RegionFactory createRegionFactory(RegionShortcut preDefinedRegion);
 
   CacheTransactionManagerPtr getCacheTransactionManager();
 
diff --git a/cppcache/src/RegionFactory.cpp b/cppcache/src/RegionFactory.cpp
index 6d2b41a..90f4111 100644
--- a/cppcache/src/RegionFactory.cpp
+++ b/cppcache/src/RegionFactory.cpp
@@ -43,8 +43,6 @@ RegionFactory::RegionFactory(RegionShortcut preDefinedRegion,
   setRegionShortcut();
 }
 
-RegionFactory::~RegionFactory() {}
-
 RegionPtr RegionFactory::create(const char* name) {
   RegionPtr retRegionPtr = nullptr;
   RegionAttributesPtr regAttr = m_attributeFactory->createRegionAttributes();
@@ -82,136 +80,135 @@ void RegionFactory::setRegionShortcut() {
   }
 }
 
-RegionFactoryPtr RegionFactory::setCacheLoader(
+RegionFactory& RegionFactory::setCacheLoader(
     const CacheLoaderPtr& cacheLoader) {
   m_attributeFactory->setCacheLoader(cacheLoader);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setCacheWriter(
+RegionFactory& RegionFactory::setCacheWriter(
     const CacheWriterPtr& cacheWriter) {
   m_attributeFactory->setCacheWriter(cacheWriter);
-  return shared_from_this();
+  return *this;
 }
-RegionFactoryPtr RegionFactory::setCacheListener(
+RegionFactory& RegionFactory::setCacheListener(
     const CacheListenerPtr& aListener) {
   m_attributeFactory->setCacheListener(aListener);
-  return shared_from_this();
+  return *this;
 }
-RegionFactoryPtr RegionFactory::setPartitionResolver(
+RegionFactory& RegionFactory::setPartitionResolver(
     const PartitionResolverPtr& aResolver) {
   m_attributeFactory->setPartitionResolver(aResolver);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setCacheLoader(const char* lib,
-                                               const char* func) {
+RegionFactory& RegionFactory::setCacheLoader(const char* lib,
+                                             const char* func) {
   m_attributeFactory->setCacheLoader(lib, func);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setCacheWriter(const char* lib,
-                                               const char* func) {
+RegionFactory& RegionFactory::setCacheWriter(const char* lib,
+                                             const char* func) {
   m_attributeFactory->setCacheWriter(lib, func);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setCacheListener(const char* lib,
-                                                 const char* func) {
+RegionFactory& RegionFactory::setCacheListener(const char* lib,
+                                               const char* func) {
   m_attributeFactory->setCacheListener(lib, func);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setPartitionResolver(const char* lib,
-                                                     const char* func) {
+RegionFactory& RegionFactory::setPartitionResolver(const char* lib,
+                                                   const char* func) {
   m_attributeFactory->setPartitionResolver(lib, func);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setEntryIdleTimeout(
+RegionFactory& RegionFactory::setEntryIdleTimeout(
     ExpirationAction::Action action, int idleTimeout) {
   m_attributeFactory->setEntryIdleTimeout(action, idleTimeout);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setEntryTimeToLive(
+RegionFactory& RegionFactory::setEntryTimeToLive(
     ExpirationAction::Action action, int timeToLive) {
   m_attributeFactory->setEntryTimeToLive(action, timeToLive);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setRegionIdleTimeout(
+RegionFactory& RegionFactory::setRegionIdleTimeout(
     ExpirationAction::Action action, int idleTimeout) {
   m_attributeFactory->setRegionIdleTimeout(action, idleTimeout);
-  return shared_from_this();
+  return *this;
 }
-RegionFactoryPtr RegionFactory::setRegionTimeToLive(
+RegionFactory& RegionFactory::setRegionTimeToLive(
     ExpirationAction::Action action, int timeToLive) {
   m_attributeFactory->setRegionTimeToLive(action, timeToLive);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setInitialCapacity(int initialCapacity) {
+RegionFactory& RegionFactory::setInitialCapacity(int initialCapacity) {
   char excpStr[256] = {0};
   if (initialCapacity < 0) {
     ACE_OS::snprintf(excpStr, 256, "initialCapacity must be >= 0 ");
     throw IllegalArgumentException(excpStr);
   }
   m_attributeFactory->setInitialCapacity(initialCapacity);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setLoadFactor(float loadFactor) {
+RegionFactory& RegionFactory::setLoadFactor(float loadFactor) {
   m_attributeFactory->setLoadFactor(loadFactor);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setConcurrencyLevel(uint8_t concurrencyLevel) {
+RegionFactory& RegionFactory::setConcurrencyLevel(uint8_t concurrencyLevel) {
   m_attributeFactory->setConcurrencyLevel(concurrencyLevel);
-  return shared_from_this();
+  return *this;
 }
-RegionFactoryPtr RegionFactory::setConcurrencyChecksEnabled(bool enable) {
+RegionFactory& RegionFactory::setConcurrencyChecksEnabled(bool enable) {
   m_attributeFactory->setConcurrencyChecksEnabled(enable);
-  return shared_from_this();
+  return *this;
 }
-RegionFactoryPtr RegionFactory::setLruEntriesLimit(
-    const uint32_t entriesLimit) {
+RegionFactory& RegionFactory::setLruEntriesLimit(const uint32_t entriesLimit) {
   m_attributeFactory->setLruEntriesLimit(entriesLimit);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setDiskPolicy(
+RegionFactory& RegionFactory::setDiskPolicy(
     const DiskPolicyType::PolicyType diskPolicy) {
   m_attributeFactory->setDiskPolicy(diskPolicy);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setCachingEnabled(bool cachingEnabled) {
+RegionFactory& RegionFactory::setCachingEnabled(bool cachingEnabled) {
   m_attributeFactory->setCachingEnabled(cachingEnabled);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setPersistenceManager(
+RegionFactory& RegionFactory::setPersistenceManager(
     const PersistenceManagerPtr& persistenceManager,
     const PropertiesPtr& config) {
   m_attributeFactory->setPersistenceManager(persistenceManager, config);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setPersistenceManager(
+RegionFactory& RegionFactory::setPersistenceManager(
     const char* lib, const char* func, const PropertiesPtr& config) {
   m_attributeFactory->setPersistenceManager(lib, func, config);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setPoolName(const char* name) {
+RegionFactory& RegionFactory::setPoolName(const char* name) {
   m_attributeFactory->setPoolName(name);
-  return shared_from_this();
+  return *this;
 }
 
-RegionFactoryPtr RegionFactory::setCloningEnabled(bool isClonable) {
+RegionFactory& RegionFactory::setCloningEnabled(bool isClonable) {
   m_attributeFactory->setCloningEnabled(isClonable);
-  return shared_from_this();
+  return *this;
 }
 }  // namespace client
 }  // namespace geode
diff --git a/tests/cpp/fwklib/RegionHelper.hpp b/tests/cpp/fwklib/RegionHelper.hpp
index 451d228..d635803 100644
--- a/tests/cpp/fwklib/RegionHelper.hpp
+++ b/tests/cpp/fwklib/RegionHelper.hpp
@@ -146,59 +146,59 @@ class RegionHelper {
 
     return sString;
   }
-  void setRegionAttributes(RegionFactoryPtr& regionFac) {
+  void setRegionAttributes(RegionFactory& regionFac) {
     RegionAttributesPtr atts = m_region->getAttributesPtr();
-    regionFac->setCachingEnabled(atts->getCachingEnabled());
+    regionFac.setCachingEnabled(atts->getCachingEnabled());
     if (atts->getCacheListenerLibrary() != NULL &&
         atts->getCacheListenerFactory() != NULL) {
-      regionFac->setCacheListener(atts->getCacheListenerLibrary(),
-                                  atts->getCacheListenerFactory());
+      regionFac.setCacheListener(atts->getCacheListenerLibrary(),
+                                 atts->getCacheListenerFactory());
     }
     if (atts->getCacheLoaderLibrary() != NULL &&
         atts->getCacheLoaderFactory() != NULL) {
-      regionFac->setCacheLoader(atts->getCacheLoaderLibrary(),
-                                atts->getCacheLoaderFactory());
+      regionFac.setCacheLoader(atts->getCacheLoaderLibrary(),
+                               atts->getCacheLoaderFactory());
     }
     if (atts->getCacheWriterLibrary() != NULL &&
         atts->getCacheWriterFactory() != NULL) {
-      regionFac->setCacheWriter(atts->getCacheWriterLibrary(),
-                                atts->getCacheWriterFactory());
+      regionFac.setCacheWriter(atts->getCacheWriterLibrary(),
+                               atts->getCacheWriterFactory());
     }
     if (atts->getEntryIdleTimeout() != 0) {
-      regionFac->setEntryIdleTimeout(atts->getEntryIdleTimeoutAction(),
-                                     atts->getEntryIdleTimeout());
+      regionFac.setEntryIdleTimeout(atts->getEntryIdleTimeoutAction(),
+                                    atts->getEntryIdleTimeout());
     }
     if (atts->getEntryTimeToLive() != 0) {
-      regionFac->setEntryTimeToLive(atts->getEntryTimeToLiveAction(),
-                                    atts->getEntryTimeToLive());
+      regionFac.setEntryTimeToLive(atts->getEntryTimeToLiveAction(),
+                                   atts->getEntryTimeToLive());
     }
     if (atts->getRegionIdleTimeout() != 0) {
-      regionFac->setRegionIdleTimeout(atts->getRegionIdleTimeoutAction(),
-                                      atts->getRegionIdleTimeout());
+      regionFac.setRegionIdleTimeout(atts->getRegionIdleTimeoutAction(),
+                                     atts->getRegionIdleTimeout());
     }
     if (atts->getRegionTimeToLive() != 0) {
-      regionFac->setRegionTimeToLive(atts->getRegionTimeToLiveAction(),
-                                     atts->getRegionTimeToLive());
+      regionFac.setRegionTimeToLive(atts->getRegionTimeToLiveAction(),
+                                    atts->getRegionTimeToLive());
     }
     if (atts->getPartitionResolverLibrary() != NULL &&
         atts->getPartitionResolverFactory() != NULL) {
-      regionFac->setPartitionResolver(atts->getPartitionResolverLibrary(),
-                                      atts->getPartitionResolverFactory());
+      regionFac.setPartitionResolver(atts->getPartitionResolverLibrary(),
+                                     atts->getPartitionResolverFactory());
     }
     if (atts->getPersistenceLibrary() != NULL &&
         atts->getPersistenceFactory() != NULL) {
-      regionFac->setPersistenceManager(atts->getPersistenceLibrary(),
-                                       atts->getPersistenceFactory(),
-                                       atts->getPersistenceProperties());
+      regionFac.setPersistenceManager(atts->getPersistenceLibrary(),
+                                      atts->getPersistenceFactory(),
+                                      atts->getPersistenceProperties());
     }
-    regionFac->setInitialCapacity(atts->getInitialCapacity());
-    regionFac->setLoadFactor(atts->getLoadFactor());
-    regionFac->setConcurrencyLevel(atts->getConcurrencyLevel());
-    regionFac->setLruEntriesLimit(atts->getLruEntriesLimit());
-    regionFac->setDiskPolicy(atts->getDiskPolicy());
-    regionFac->setCloningEnabled(atts->getCloningEnabled());
-    regionFac->setPoolName(atts->getPoolName());
-    regionFac->setConcurrencyChecksEnabled(atts->getConcurrencyChecksEnabled());
+    regionFac.setInitialCapacity(atts->getInitialCapacity());
+    regionFac.setLoadFactor(atts->getLoadFactor());
+    regionFac.setConcurrencyLevel(atts->getConcurrencyLevel());
+    regionFac.setLruEntriesLimit(atts->getLruEntriesLimit());
+    regionFac.setDiskPolicy(atts->getDiskPolicy());
+    regionFac.setCloningEnabled(atts->getCloningEnabled());
+    regionFac.setPoolName(atts->getPoolName());
+    regionFac.setConcurrencyChecksEnabled(atts->getConcurrencyChecksEnabled());
   }
 
   RegionPtr createRootRegion(CachePtr& cachePtr) {
@@ -211,8 +211,6 @@ class RegionHelper {
   }
 
   RegionPtr createRootRegion(CachePtr& cachePtr, std::string regionName) {
-    RegionPtr region;
-    RegionFactoryPtr regionFac;
     if (regionName.empty()) {
       regionName = m_region->getName();
       FWKINFO("region name is " << regionName);
@@ -220,23 +218,9 @@ class RegionHelper {
         FWKEXCEPTION("Region name not specified.");
       }
     }
-    regionFac = cachePtr->createRegionFactory(CACHING_PROXY);
+    auto regionFac = cachePtr->createRegionFactory(CACHING_PROXY);
     setRegionAttributes(regionFac);
-    RegionAttributesPtr atts = m_region->getAttributesPtr();
-    /*   if(atts->getCachingEnabled())
-       {
-         regionFac=cachePtr->createRegionFactory(CACHING_PROXY);
-         regionFac->setCachingEnabled(true);
-         FWKINFO("Setting CachingEnabled=true");
-       }
-       else
-       {
-         regionFac=cachePtr->createRegionFactory(PROXY);
-         regionFac->setCachingEnabled(false);
-         FWKINFO("Setting CachingEnabled=false");
-       }*/
-    // UNUSED bool hasEndpoints = ( NULL != atts->getEndpoints() ) ? true :
-    // false;
+    auto atts = m_region->getAttributesPtr();
     bool withPool = (NULL != atts->getPoolName()) ? true : false;
     std::string poolName;
     if (withPool) {
@@ -244,7 +228,7 @@ class RegionHelper {
     } else {
       poolName = "";
     }
-    region = regionFac->create(regionName.c_str());
+    auto region = regionFac.create(regionName.c_str());
     FWKINFO("Region created with name = " << regionName + " and pool name= "
                                           << poolName);
     FWKINFO(" Region Created with following attributes :"

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <commits@geode.apache.org>.

Mime
View raw message