You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/03/07 01:36:56 UTC

[16/21] geode-native git commit: GEODE-2494: Replace global statics with class scoped statics.

GEODE-2494: Replace global statics with class scoped statics.


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

Branch: refs/heads/feature/GEODE-2602
Commit: eb4fd82cba5ab0a664a880c32b8c7f6e16dbeb23
Parents: 80fd387
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Mon Feb 27 18:09:46 2017 -0800
Committer: Jacob Barrett <jb...@pivotal.io>
Committed: Mon Mar 6 17:32:11 2017 -0800

----------------------------------------------------------------------
 src/cppcache/src/CqQueryVsdStats.cpp   | 5 +----
 src/cppcache/src/CqQueryVsdStats.hpp   | 2 ++
 src/cppcache/src/CqServiceVsdStats.cpp | 6 +-----
 src/cppcache/src/CqServiceVsdStats.hpp | 2 ++
 src/cppcache/src/LRUList.hpp           | 9 ++++-----
 src/cppcache/src/RegionStats.cpp       | 3 ---
 src/cppcache/src/RegionStats.hpp       | 2 ++
 7 files changed, 12 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode-native/blob/eb4fd82c/src/cppcache/src/CqQueryVsdStats.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqQueryVsdStats.cpp b/src/cppcache/src/CqQueryVsdStats.cpp
index ceb40a6..f24208a 100644
--- a/src/cppcache/src/CqQueryVsdStats.cpp
+++ b/src/cppcache/src/CqQueryVsdStats.cpp
@@ -26,9 +26,6 @@
 
 #include "util/concurrent/spinlock_mutex.hpp"
 
-const char* cqStatsName = "CqQueryStatistics";
-const char* cqStatsDesc = "Statistics for this cq query";
-
 ////////////////////////////////////////////////////////////////////////////////
 
 namespace apache {
@@ -65,7 +62,7 @@ StatisticsType* CqQueryStatType::getStatType() {
         "events", "The total number of events for this cq query", "entries",
         largerIsBetter);
 
-    statsType = factory->createType(cqStatsName, cqStatsDesc, m_stats, 4);
+    statsType = factory->createType(statsName, statsDesc, m_stats, 4);
 
     m_numInsertsId = statsType->nameToId("inserts");
     m_numUpdatesId = statsType->nameToId("updates");

http://git-wip-us.apache.org/repos/asf/geode-native/blob/eb4fd82c/src/cppcache/src/CqQueryVsdStats.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqQueryVsdStats.hpp b/src/cppcache/src/CqQueryVsdStats.hpp
index 3cc5672..fdfae5a 100644
--- a/src/cppcache/src/CqQueryVsdStats.hpp
+++ b/src/cppcache/src/CqQueryVsdStats.hpp
@@ -79,6 +79,8 @@ class CPPCACHE_EXPORT CqQueryVsdStats : public CqStatistics {
 class CqQueryStatType {
  private:
   static spinlock_mutex m_statTypeLock;
+  static constexpr const char* statsName = "CqQueryStatistics";
+  static constexpr const char* statsDesc = "Statistics for this cq query";
 
  public:
   static CqQueryStatType& getInstance();

http://git-wip-us.apache.org/repos/asf/geode-native/blob/eb4fd82c/src/cppcache/src/CqServiceVsdStats.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqServiceVsdStats.cpp b/src/cppcache/src/CqServiceVsdStats.cpp
index 08f331b..562224f 100644
--- a/src/cppcache/src/CqServiceVsdStats.cpp
+++ b/src/cppcache/src/CqServiceVsdStats.cpp
@@ -26,9 +26,6 @@
 
 #include "util/concurrent/spinlock_mutex.hpp"
 
-const char* cqServiceStatsName = "CqServiceStatistics";
-const char* cqServiceStatsDesc = "Statistics for this cq Service";
-
 ////////////////////////////////////////////////////////////////////////////////
 
 namespace apache {
@@ -69,8 +66,7 @@ StatisticsType* CqServiceStatType::getStatType() {
         "The total number of Cqs on the client for this cq Service", "entries",
         largerIsBetter);
 
-    statsType =
-        factory->createType(cqServiceStatsName, cqServiceStatsDesc, m_stats, 5);
+    statsType = factory->createType(statsName, statsDesc, m_stats, 5);
 
     m_numCqsActiveId = statsType->nameToId("CqsActive");
     m_numCqsCreatedId = statsType->nameToId("CqsCreated");

http://git-wip-us.apache.org/repos/asf/geode-native/blob/eb4fd82c/src/cppcache/src/CqServiceVsdStats.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqServiceVsdStats.hpp b/src/cppcache/src/CqServiceVsdStats.hpp
index 710dfdb..9946e2b 100644
--- a/src/cppcache/src/CqServiceVsdStats.hpp
+++ b/src/cppcache/src/CqServiceVsdStats.hpp
@@ -113,6 +113,8 @@ class CPPCACHE_EXPORT CqServiceVsdStats : public CqServiceStatistics {
 class CqServiceStatType {
  private:
   static spinlock_mutex m_statTypeLock;
+  static constexpr const char* statsName = "CqServiceStatistics";
+  static constexpr const char* statsDesc = "Statistics for this cq Service";
 
  public:
   static CqServiceStatType& getInstance();

http://git-wip-us.apache.org/repos/asf/geode-native/blob/eb4fd82c/src/cppcache/src/LRUList.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LRUList.hpp b/src/cppcache/src/LRUList.hpp
index fc18fcd..0364ac6 100644
--- a/src/cppcache/src/LRUList.hpp
+++ b/src/cppcache/src/LRUList.hpp
@@ -31,11 +31,6 @@ namespace apache {
 namespace geode {
 namespace client {
 
-// Bit mask for recently used
-#define RECENTLY_USED_BITS 1u
-// Bit mask for evicted
-#define EVICTED_BITS 2u
-
 /**
  * @brief This class encapsulates LRU specific properties for a LRUList node.
  */
@@ -72,6 +67,10 @@ class CPPCACHE_EXPORT LRUEntryProperties {
  private:
   std::atomic<uint32_t> m_bits;
   void* m_persistenceInfo;
+  // Bit mask for recently used
+  static constexpr uint32_t RECENTLY_USED_BITS = 1u;
+  // Bit mask for evicted
+  static constexpr uint32_t EVICTED_BITS = 2u;
 };
 
 using util::concurrent::spinlock_mutex;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/eb4fd82c/src/cppcache/src/RegionStats.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionStats.cpp b/src/cppcache/src/RegionStats.cpp
index 285cf76..677ec7c 100644
--- a/src/cppcache/src/RegionStats.cpp
+++ b/src/cppcache/src/RegionStats.cpp
@@ -27,9 +27,6 @@
 
 #include "util/concurrent/spinlock_mutex.hpp"
 
-const char* statsName = "RegionStatistics";
-const char* statsDesc = "Statistics for this region";
-
 ////////////////////////////////////////////////////////////////////////////////
 
 namespace apache {

http://git-wip-us.apache.org/repos/asf/geode-native/blob/eb4fd82c/src/cppcache/src/RegionStats.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionStats.hpp b/src/cppcache/src/RegionStats.hpp
index 1f72d77..30ad7df 100644
--- a/src/cppcache/src/RegionStats.hpp
+++ b/src/cppcache/src/RegionStats.hpp
@@ -132,6 +132,8 @@ class RegionStatType {
   static RegionStatType* single;
   static spinlock_mutex m_singletonLock;
   static spinlock_mutex m_statTypeLock;
+  static constexpr const char* statsName = "RegionStatistics";
+  static constexpr const char* statsDesc = "Statistics for this region";
 
  public:
   static RegionStatType* getInstance();