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.
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 @@
       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 @@
   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