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
The following commit(s) were added to refs/heads/develop by this push:
new e8b9cb1 GEODE-4410: Move StatisticsManager from DistributedSystem to
Cache. (#273)
e8b9cb1 is described below
commit e8b9cb1beb91cf93d0c317c7e358ebb5533ee80d
Author: Michael Martell <[email protected]>
AuthorDate: Mon Apr 16 13:11:51 2018 -0700
GEODE-4410: Move StatisticsManager from DistributedSystem to Cache. (#273)
---
cppcache/include/geode/DistributedSystem.hpp | 2 --
cppcache/src/AdminRegion.cpp | 6 +-----
cppcache/src/CacheImpl.cpp | 18 +++++++++++++++++-
cppcache/src/CacheImpl.hpp | 6 ++++++
cppcache/src/DistributedSystem.cpp | 4 ----
cppcache/src/DistributedSystemImpl.cpp | 17 -----------------
cppcache/src/DistributedSystemImpl.hpp | 5 -----
cppcache/src/LocalRegion.cpp | 6 ++----
cppcache/src/RemoteQueryService.cpp | 5 ++---
cppcache/src/ThinClientPoolDM.cpp | 12 ++++--------
cppcache/src/statistics/PoolStatsSampler.cpp | 5 ++---
11 files changed, 34 insertions(+), 52 deletions(-)
diff --git a/cppcache/include/geode/DistributedSystem.hpp
b/cppcache/include/geode/DistributedSystem.hpp
index c4822ac..0242219 100644
--- a/cppcache/include/geode/DistributedSystem.hpp
+++ b/cppcache/include/geode/DistributedSystem.hpp
@@ -97,8 +97,6 @@ class APACHE_GEODE_EXPORT DistributedSystem {
*/
const std::string& getName() const;
- statistics::StatisticsManager* getStatisticsManager() const;
-
protected:
/**
* @brief constructors
diff --git a/cppcache/src/AdminRegion.cpp b/cppcache/src/AdminRegion.cpp
index e2610e7..9a4bdf0 100644
--- a/cppcache/src/AdminRegion.cpp
+++ b/cppcache/src/AdminRegion.cpp
@@ -39,11 +39,7 @@ std::shared_ptr<AdminRegion> AdminRegion::create(CacheImpl*
cache,
if (!distMan) {
adminRegion->m_distMngr =
new
ThinClientCacheDistributionManager(*adminRegion->m_connectionMgr);
- auto mngr = cache->getDistributedSystem().getStatisticsManager();
- if (mngr) {
- // Register it with StatisticsManager
- mngr->RegisterAdminRegion(adminRegion);
- }
+ cache->getStatisticsManager().RegisterAdminRegion(adminRegion);
} else {
adminRegion->m_distMngr = distMan;
}
diff --git a/cppcache/src/CacheImpl.cpp b/cppcache/src/CacheImpl.cpp
index b475ba3..330933c 100644
--- a/cppcache/src/CacheImpl.cpp
+++ b/cppcache/src/CacheImpl.cpp
@@ -52,6 +52,7 @@ CacheImpl::CacheImpl(Cache* c, DistributedSystem&&
distributedSystem,
m_readPdxSerialized(readPdxSerialized),
m_expiryTaskManager(
std::unique_ptr<ExpiryTaskManager>(new ExpiryTaskManager())),
+ m_statisticsManager(nullptr),
m_closed(false),
m_initialized(false),
m_distributedSystem(std::move(distributedSystem)),
@@ -72,6 +73,7 @@ CacheImpl::CacheImpl(Cache* c, DistributedSystem&&
distributedSystem,
m_threadPool(new ThreadPool(
m_distributedSystem.getSystemProperties().threadPoolSize())),
m_authInitialize(authInitialize) {
+
m_cacheTXManager = std::shared_ptr<InternalCacheTransactionManager2PC>(
new InternalCacheTransactionManager2PCImpl(this));
@@ -89,6 +91,19 @@ CacheImpl::CacheImpl(Cache* c, DistributedSystem&&
distributedSystem,
m_initialized = true;
m_pdxTypeRegistry = std::make_shared<PdxTypeRegistry>(this);
m_poolManager = std::unique_ptr<PoolManager>(new PoolManager(this));
+
+ try {
+ m_statisticsManager =
+ std::unique_ptr<StatisticsManager>(new StatisticsManager(
+ prop.statisticsArchiveFile().c_str(),
+ prop.statisticsSampleInterval(), prop.statisticsEnabled(), this,
+ prop.statsFileSizeLimit(), prop.statsDiskSpaceLimit()));
+ m_cacheStats =
+ new CachePerfStats(m_statisticsManager->getStatisticsFactory());
+ } catch (const NullPointerException&) {
+ Log::close();
+ throw;
+ }
}
void CacheImpl::initServices() {
@@ -220,7 +235,8 @@ const std::string& CacheImpl::getName() const {
bool CacheImpl::isClosed() const { return m_closed; }
-void CacheImpl::setAttributes(const std::shared_ptr<CacheAttributes>&
attributes) {
+void CacheImpl::setAttributes(
+ const std::shared_ptr<CacheAttributes>& attributes) {
if (m_attributes == nullptr && attributes != nullptr) {
m_attributes = attributes;
}
diff --git a/cppcache/src/CacheImpl.hpp b/cppcache/src/CacheImpl.hpp
index 7308a89..efeb409 100644
--- a/cppcache/src/CacheImpl.hpp
+++ b/cppcache/src/CacheImpl.hpp
@@ -273,6 +273,10 @@ class APACHE_GEODE_EXPORT CacheImpl : private NonCopyable,
return m_authInitialize;
}
+ statistics::StatisticsManager& getStatisticsManager() const {
+ return *(m_statisticsManager.get());
+ }
+
virtual std::unique_ptr<DataOutput> createDataOutput() const;
virtual std::unique_ptr<DataOutput> createDataOutput(Pool* pool) const;
@@ -297,6 +301,8 @@ class APACHE_GEODE_EXPORT CacheImpl : private NonCopyable,
std::unique_ptr<PoolManager> m_poolManager;
+ std::unique_ptr<statistics::StatisticsManager> m_statisticsManager;
+
enum RegionKind {
CPP_REGION,
THINCLIENT_REGION,
diff --git a/cppcache/src/DistributedSystem.cpp
b/cppcache/src/DistributedSystem.cpp
index 8fd41b8..380c28d 100644
--- a/cppcache/src/DistributedSystem.cpp
+++ b/cppcache/src/DistributedSystem.cpp
@@ -114,10 +114,6 @@ const std::string& DistributedSystem::getName() const {
return m_impl->getName();
}
-statistics::StatisticsManager* DistributedSystem::getStatisticsManager() const
{
- return m_impl->getStatisticsManager();
-}
-
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/DistributedSystemImpl.cpp
b/cppcache/src/DistributedSystemImpl.cpp
index 5417aa0..982b286 100644
--- a/cppcache/src/DistributedSystemImpl.cpp
+++ b/cppcache/src/DistributedSystemImpl.cpp
@@ -42,7 +42,6 @@ DistributedSystemImpl::DistributedSystemImpl(
std::unique_ptr<SystemProperties> sysProps)
: m_name(name),
m_implementee(implementee),
- m_statisticsManager(nullptr),
m_sysProps(std::move(sysProps)),
m_connected(false) {
if (!m_sysProps->securityClientDhAlgo().empty()) {
@@ -62,22 +61,6 @@ void DistributedSystemImpl::connect(Cache* cache) {
"get it");
}
- auto cacheImpl = CacheRegionHelper::getCacheImpl(cache);
- try {
- m_statisticsManager =
- std::unique_ptr<StatisticsManager>(new StatisticsManager(
- m_sysProps->statisticsArchiveFile().c_str(),
- m_sysProps->statisticsSampleInterval(),
- m_sysProps->statisticsEnabled(), cacheImpl,
- m_sysProps->statsFileSizeLimit(),
- m_sysProps->statsDiskSpaceLimit()));
- cacheImpl->m_cacheStats =
- new CachePerfStats(getStatisticsManager()->getStatisticsFactory());
- } catch (const NullPointerException&) {
- Log::close();
- throw;
- }
-
m_connected = true;
}
diff --git a/cppcache/src/DistributedSystemImpl.hpp
b/cppcache/src/DistributedSystemImpl.hpp
index 6686a94..7eac4e8 100644
--- a/cppcache/src/DistributedSystemImpl.hpp
+++ b/cppcache/src/DistributedSystemImpl.hpp
@@ -82,10 +82,6 @@ class APACHE_GEODE_EXPORT DistributedSystemImpl {
virtual const std::string& getName() const;
- statistics::StatisticsManager* getStatisticsManager() const {
- return m_statisticsManager.get();
- }
-
SystemProperties& getSystemProperties() const;
std::string m_name;
@@ -111,7 +107,6 @@ class APACHE_GEODE_EXPORT DistributedSystemImpl {
static ACE_Recursive_Thread_Mutex m_cliCallbackLock;
static volatile bool m_isCliCallbackSet;
static std::map<int, CliCallbackMethod> m_cliCallbackMap;
- std::unique_ptr<statistics::StatisticsManager> m_statisticsManager;
std::unique_ptr<SystemProperties> m_sysProps;
bool m_connected;
};
diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp
index 8559d38..7d28a00 100644
--- a/cppcache/src/LocalRegion.cpp
+++ b/cppcache/src/LocalRegion.cpp
@@ -88,10 +88,8 @@ LocalRegion::LocalRegion(const std::string& name, CacheImpl*
cacheImpl,
(m_fullPath = "/") += m_name;
}
- m_regionStats = new RegionStats(cacheImpl->getDistributedSystem()
- .getStatisticsManager()
- ->getStatisticsFactory(),
- m_fullPath);
+ m_regionStats = new RegionStats(
+ cacheImpl->getStatisticsManager().getStatisticsFactory(), m_fullPath);
auto p = cacheImpl->getPoolManager().find(getAttributes().getPoolName());
setPool(p);
}
diff --git a/cppcache/src/RemoteQueryService.cpp
b/cppcache/src/RemoteQueryService.cpp
index a940266..e66154f 100644
--- a/cppcache/src/RemoteQueryService.cpp
+++ b/cppcache/src/RemoteQueryService.cpp
@@ -32,9 +32,8 @@ RemoteQueryService::RemoteQueryService(CacheImpl* cache,
ThinClientPoolDM* poolDM)
: m_invalid(true),
m_cqService(nullptr),
- m_statisticsFactory(cache->getDistributedSystem()
- .getStatisticsManager()
- ->getStatisticsFactory()) {
+ m_statisticsFactory(
+ cache->getStatisticsManager().getStatisticsFactory()) {
if (poolDM) {
m_tccdm = poolDM;
} else {
diff --git a/cppcache/src/ThinClientPoolDM.cpp
b/cppcache/src/ThinClientPoolDM.cpp
index 1f2a86e..c397f58 100644
--- a/cppcache/src/ThinClientPoolDM.cpp
+++ b/cppcache/src/ThinClientPoolDM.cpp
@@ -198,10 +198,9 @@ ThinClientPoolDM::ThinClientPoolDM(const char* name,
reset();
m_locHelper = new ThinClientLocatorHelper(m_attrs->m_initLocList, this);
- auto statisticsManager = distributedSystem.getStatisticsManager();
- m_stats =
- new PoolStats(statisticsManager->getStatisticsFactory(), m_poolName);
- statisticsManager->forceSample();
+ m_stats = new PoolStats(
+ cacheImpl->getStatisticsManager().getStatisticsFactory(), m_poolName);
+ cacheImpl->getStatisticsManager().forceSample();
if (!sysProp.isEndpointShufflingDisabled()) {
if (m_attrs->m_initServList.size() > 0) {
@@ -833,10 +832,7 @@ void ThinClientPoolDM::destroy(bool keepAlive) {
// Close Stats
getStats().close();
- m_connManager.getCacheImpl()
- ->getDistributedSystem()
- .getStatisticsManager()
- ->forceSample();
+ m_connManager.getCacheImpl()->getStatisticsManager().forceSample();
if (m_clientMetadataService != nullptr) {
_GEODE_SAFE_DELETE(m_clientMetadataService);
diff --git a/cppcache/src/statistics/PoolStatsSampler.cpp
b/cppcache/src/statistics/PoolStatsSampler.cpp
index 7f35f8b..e01651f 100644
--- a/cppcache/src/statistics/PoolStatsSampler.cpp
+++ b/cppcache/src/statistics/PoolStatsSampler.cpp
@@ -41,9 +41,8 @@ PoolStatsSampler::PoolStatsSampler(milliseconds sampleRate,
CacheImpl* cache,
ThinClientPoolDM* distMan)
: m_sampleRate(sampleRate),
m_distMan(distMan),
- m_statisticsFactory(cache->getDistributedSystem()
- .getStatisticsManager()
- ->getStatisticsFactory()) {
+ m_statisticsFactory(
+ cache->getStatisticsManager().getStatisticsFactory()) {
m_running = false;
m_stopRequested = false;
m_adminRegion = AdminRegion::create(cache, distMan);
--
To stop receiving notification emails like this one, please contact
[email protected].