You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bb...@apache.org on 2019/04/04 14:02:30 UTC

[geode-native] branch develop updated: GEODE-6597: Add appDomainContext to the ClientMetaDataService. (#471)

This is an automated email from the ASF dual-hosted git repository.

bbender 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 843f728  GEODE-6597: Add appDomainContext to the ClientMetaDataService. (#471)
843f728 is described below

commit 843f728338765b5d111308b64bc29384acdebdec
Author: Michael Martell <mm...@pivotal.io>
AuthorDate: Thu Apr 4 07:02:25 2019 -0700

    GEODE-6597: Add appDomainContext to the ClientMetaDataService. (#471)
    
    - This fixes the occasional "can't pass GCHandle across AppDomains" exception caused by the ClientMetaDataService background thread.
---
 cppcache/src/ClientMetadataService.cpp | 12 ++++++++----
 cppcache/src/ClientMetadataService.hpp |  2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/cppcache/src/ClientMetadataService.cpp b/cppcache/src/ClientMetadataService.cpp
index d6f975c..ba3ea21 100644
--- a/cppcache/src/ClientMetadataService.cpp
+++ b/cppcache/src/ClientMetadataService.cpp
@@ -45,13 +45,17 @@ ClientMetadataService::ClientMetadataService(ThinClientPoolDM* pool)
       m_regionQueue(false),
       m_bucketWaitTimeout(m_cache->getDistributedSystem()
                               .getSystemProperties()
-                              .bucketWaitTimeout())
-
-{}
+                              .bucketWaitTimeout()),
+      m_appDomainContext(createAppDomainContext()) {}
 
 void ClientMetadataService::start() {
   m_run = true;
-  m_thread = std::thread(&ClientMetadataService::svc, this);
+  if (m_appDomainContext) {
+    m_thread =
+        std::thread([this] { m_appDomainContext->run([&] { this->svc(); }); });
+  } else {
+    m_thread = std::thread(&ClientMetadataService::svc, this);
+  }
 }
 
 void ClientMetadataService::stop() {
diff --git a/cppcache/src/ClientMetadataService.hpp b/cppcache/src/ClientMetadataService.hpp
index 5de4379..40d47a9 100644
--- a/cppcache/src/ClientMetadataService.hpp
+++ b/cppcache/src/ClientMetadataService.hpp
@@ -37,6 +37,7 @@
 #include <geode/Serializable.hpp>
 #include <geode/internal/functional.hpp>
 
+#include "AppDomainContext.hpp"
 #include "BucketServerLocation.hpp"
 #include "NonCopyable.hpp"
 #include "ServerLocation.hpp"
@@ -211,6 +212,7 @@ class ClientMetadataService : private NonCopyable, private NonAssignable {
   std::map<std::string, std::unique_ptr<PRbuckets>> m_bucketStatus;
   std::chrono::milliseconds m_bucketWaitTimeout;
   static const char* NC_CMDSvcThread;
+  std::unique_ptr<AppDomainContext> m_appDomainContext;
 };
 }  // namespace client
 }  // namespace geode