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 2022/02/18 16:51:46 UTC

[geode-native] branch develop updated: GEODE-9327: Remove ACE networking code references (#815)

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 c9a893d  GEODE-9327: Remove ACE networking code references (#815)
c9a893d is described below

commit c9a893d3dbd9e43762193a780f48ef0c12192d78
Author: Mario Salazar de Torres <ma...@est.tech>
AuthorDate: Fri Feb 18 17:51:04 2022 +0100

    GEODE-9327: Remove ACE networking code references (#815)
    
     - Replaced method implementation to get a random port in old ITs framework.
     - Replaced convertHostToCanonicalForm implementation.
     - Changed ClientProxyMembershipID address serialization.
     - Removed unused PoolFactory::addCheck method.
     - Modified QueueConnectionRequestTest test to pass after the changes.
     - Fixed min/max macros windows compilcation
     - Changed ClientProxyMembershipID member attribute names to match style
       guidelines.
     - Changed HostStatSampler member attribute names to match style
     guidelines.
     - Changed Utils::convertHostToCanonicalForm to make the method more
       readable.
---
 cppcache/include/geode/PoolFactory.hpp           |   1 -
 cppcache/integration-test/CacheHelper.cpp        |  36 +++--
 cppcache/src/ClientProxyMembershipID.cpp         |  97 ++++++------
 cppcache/src/ClientProxyMembershipID.hpp         |  48 +++---
 cppcache/src/ClientProxyMembershipIDFactory.cpp  |  14 +-
 cppcache/src/PoolFactory.cpp                     |  21 ---
 cppcache/src/Utils.cpp                           |  69 ++++-----
 cppcache/src/Utils.hpp                           |   2 +-
 cppcache/src/statistics/HostStatSampler.cpp      | 183 +++++++++++------------
 cppcache/src/statistics/HostStatSampler.hpp      |  60 ++++----
 cppcache/test/QueueConnectionRequestTest.cpp     |   7 +-
 cppcache/test/statistics/HostStatSamplerTest.cpp |   4 +-
 12 files changed, 260 insertions(+), 282 deletions(-)

diff --git a/cppcache/include/geode/PoolFactory.hpp b/cppcache/include/geode/PoolFactory.hpp
index 7dc52b2..15ab278 100644
--- a/cppcache/include/geode/PoolFactory.hpp
+++ b/cppcache/include/geode/PoolFactory.hpp
@@ -542,7 +542,6 @@ class APACHE_GEODE_EXPORT PoolFactory {
 
  private:
   explicit PoolFactory(const Cache& cache);
-  PoolFactory& addCheck(const std::string& host, int port);
   std::shared_ptr<PoolAttributes> m_attrs;
   bool m_isSubscriptionRedundancy;
   bool m_addedServerOrLocator;
diff --git a/cppcache/integration-test/CacheHelper.cpp b/cppcache/integration-test/CacheHelper.cpp
index e65f15b..467cc4a 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -46,6 +46,8 @@
 #include <chrono>
 #include <thread>
 
+#include <boost/asio.hpp>
+
 #ifndef ROOT_NAME
 #define ROOT_NAME "Root"
 #endif
@@ -1535,22 +1537,28 @@ int CacheHelper::getRandomNumber() {
 }
 
 int CacheHelper::getRandomAvailablePort() {
-  while (true) {
-    int port = CacheHelper::getRandomNumber();
-    ACE_INET_Addr addr(port, "localhost");
-    ACE_SOCK_Acceptor acceptor;
-    int result = acceptor.open(addr, 0, AF_INET);
-    if (result == -1) {
-      continue;
-    } else {
-      result = acceptor.close();
-      if (result == -1) {
-        continue;
-      } else {
-        return port;
-      }
+  using boost::asio::io_service;
+  using boost::asio::ip::tcp;
+  namespace bip = boost::asio::ip;
+
+  io_service service;
+  bip::tcp::acceptor acceptor(service, bip::tcp::v4());
+
+  int result = 0;
+  while (result == 0) {
+    uint16_t port = getRandomNumber();
+    bip::tcp::endpoint ep{bip::address_v4::loopback(), port};
+
+    try {
+      acceptor.bind(ep);
+      acceptor.listen();
+      result = port;
+    } catch (boost::system::system_error &e) {
+      std::clog << "Error: " << e.what() << std::endl;
     }
   }
+
+  return result;
 }
 
 std::string CacheHelper::unitTestOutputFile() {
diff --git a/cppcache/src/ClientProxyMembershipID.cpp b/cppcache/src/ClientProxyMembershipID.cpp
index c207389..1f3211d 100644
--- a/cppcache/src/ClientProxyMembershipID.cpp
+++ b/cppcache/src/ClientProxyMembershipID.cpp
@@ -45,13 +45,13 @@ const int ClientProxyMembershipID::VERSION_MASK = 0x8;
 const int8_t ClientProxyMembershipID::TOKEN_ORDINAL = -1;
 
 ClientProxyMembershipID::ClientProxyMembershipID()
-    : m_hostPort(0), m_vmViewId(0) {}
+    : hostPort_(0), vmViewId_(0) {}
 
 ClientProxyMembershipID::~ClientProxyMembershipID() noexcept = default;
 
 ClientProxyMembershipID::ClientProxyMembershipID(
     std::string dsName, std::string randString, const std::string& hostname,
-    const ACE_INET_Addr& address, uint32_t hostPort,
+    const boost::asio::ip::address& address, uint32_t hostPort,
     const std::string& durableClientId,
     const std::chrono::seconds durableClientTimeOut) {
   auto vmPID = boost::this_process::get_id();
@@ -77,27 +77,19 @@ ClientProxyMembershipID::ClientProxyMembershipID(
 }
 
 void ClientProxyMembershipID::initHostAddressVector(
-    const ACE_INET_Addr& address) {
-  if (address.get_type() == AF_INET6) {
-    const auto socketAddress6 =
-        static_cast<const struct sockaddr_in6*>(address.get_addr());
-    auto socketAddress =
-        reinterpret_cast<const uint8_t*>(&socketAddress6->sin6_addr);
-    auto length = sizeof(socketAddress6->sin6_addr);
-    m_hostAddr.assign(socketAddress, socketAddress + length);
+    const boost::asio::ip::address& address) {
+  if (address.is_v6()) {
+    auto bytes = address.to_v6().to_bytes();
+    hostAddr_.assign(bytes.begin(), bytes.end());
   } else {
-    const auto socketAddress4 =
-        static_cast<const struct sockaddr_in*>(address.get_addr());
-    auto ipAddress =
-        reinterpret_cast<const uint8_t*>(&socketAddress4->sin_addr);
-    auto length = sizeof(socketAddress4->sin_addr);
-    m_hostAddr.assign(ipAddress, ipAddress + length);
+    auto bytes = address.to_v4().to_bytes();
+    hostAddr_.assign(bytes.begin(), bytes.end());
   }
 }
 
 void ClientProxyMembershipID::initHostAddressVector(const uint8_t* hostAddr,
                                                     uint32_t hostAddrLen) {
-  m_hostAddr.assign(hostAddr, hostAddr + hostAddrLen);
+  hostAddr_.assign(hostAddr, hostAddr + hostAddrLen);
 }
 
 void ClientProxyMembershipID::initObjectVars(
@@ -108,22 +100,21 @@ void ClientProxyMembershipID::initObjectVars(
     const char* uniqueTag, uint32_t vmViewId) {
   DataOutputInternal m_memID;
   if (dsname == nullptr) {
-    m_dsname = std::string("");
+    dsName_ = std::string("");
   } else {
-    m_dsname = std::string(dsname);
+    dsName_ = std::string(dsname);
   }
-  m_hostPort = hostPort;
+  hostPort_ = hostPort;
   if (uniqueTag == nullptr) {
-    m_uniqueTag = std::string("");
+    uniqueTag_ = std::string("");
   } else {
-    m_uniqueTag = std::string(uniqueTag);
+    uniqueTag_ = std::string(uniqueTag);
   }
 
-  m_vmViewId = vmViewId;
+  vmViewId_ = vmViewId;
   m_memID.write(static_cast<int8_t>(DSCode::FixedIDByte));
   m_memID.write(static_cast<int8_t>(DSCode::InternalDistributedMember));
-  m_memID.writeBytes(m_hostAddr.data(),
-                     static_cast<int32_t>(m_hostAddr.size()));
+  m_memID.writeBytes(hostAddr_.data(), static_cast<int32_t>(hostAddr_.size()));
   m_memID.writeInt(static_cast<int32_t>(synch_counter));
   m_memID.writeString(hostname);
   m_memID.write(splitBrainFlag);
@@ -147,45 +138,45 @@ void ClientProxyMembershipID::initObjectVars(
   size_t len;
   char* buf =
       reinterpret_cast<char*>(const_cast<uint8_t*>(m_memID.getBuffer(&len)));
-  m_memIDStr.append(buf, len);
-
-  clientID.append(hostname);
-  clientID.append("(");
-  clientID.append(std::to_string(vPID));
-  clientID.append(":loner):");
-  clientID.append(std::to_string(synch_counter));
-  clientID.append(":");
-  clientID.append(getUniqueTag());
-  clientID.append(":");
-  clientID.append(getDSName());
+  memIdStr_.append(buf, len);
+
+  clientId_.append(hostname);
+  clientId_.append("(");
+  clientId_.append(std::to_string(vPID));
+  clientId_.append(":loner):");
+  clientId_.append(std::to_string(synch_counter));
+  clientId_.append(":");
+  clientId_.append(getUniqueTag());
+  clientId_.append(":");
+  clientId_.append(getDSName());
 
   for (uint32_t i = 0; i < getHostAddrLen(); i++) {
-    m_hashKey.append(":");
-    m_hashKey.append(std::to_string(m_hostAddr[i]));
+    hashKey_.append(":");
+    hashKey_.append(std::to_string(hostAddr_[i]));
   }
-  m_hashKey.append(":");
-  m_hashKey.append(std::to_string(getHostPort()));
-  m_hashKey.append(":");
-  m_hashKey.append(getDSName());
-  m_hashKey.append(":");
-  if (!m_uniqueTag.empty()) {
-    m_hashKey.append(getUniqueTag());
+  hashKey_.append(":");
+  hashKey_.append(std::to_string(getHostPort()));
+  hashKey_.append(":");
+  hashKey_.append(getDSName());
+  hashKey_.append(":");
+  if (!uniqueTag_.empty()) {
+    hashKey_.append(getUniqueTag());
   } else {
-    m_hashKey.append(":");
-    m_hashKey.append(std::to_string(m_vmViewId));
+    hashKey_.append(":");
+    hashKey_.append(std::to_string(vmViewId_));
   }
-  LOGDEBUG("GethashKey %s client id: %s ", m_hashKey.c_str(), clientID.c_str());
+  LOGDEBUG("GethashKey %s client id: %s ", hashKey_.c_str(), clientId_.c_str());
 }
 
 const std::string& ClientProxyMembershipID::getDSMemberId() const {
-  return m_memIDStr;
+  return memIdStr_;
 }
 
 const std::string& ClientProxyMembershipID::getDSMemberIdForThinClientUse() {
-  return clientID;
+  return clientId_;
 }
 
-std::string ClientProxyMembershipID::getHashKey() { return m_hashKey; }
+std::string ClientProxyMembershipID::getHashKey() { return hashKey_; }
 
 void ClientProxyMembershipID::toData(DataOutput&) const {
   throw IllegalStateException("Member ID toData() not implemented.");
@@ -322,9 +313,9 @@ int16_t ClientProxyMembershipID::compareTo(
   std::string myUniqueTag = getUniqueTag();
   std::string otherUniqueTag = otherMember.getUniqueTag();
   if (myUniqueTag.empty() && otherUniqueTag.empty()) {
-    if (m_vmViewId < otherMember.m_vmViewId) {
+    if (vmViewId_ < otherMember.vmViewId_) {
       return -1;
-    } else if (m_vmViewId > otherMember.m_vmViewId) {
+    } else if (vmViewId_ > otherMember.vmViewId_) {
       return 1;
     }  // else they're the same, so continue
   } else if (myUniqueTag.empty()) {
diff --git a/cppcache/src/ClientProxyMembershipID.hpp b/cppcache/src/ClientProxyMembershipID.hpp
index 3dd4b3c..c09a95a 100644
--- a/cppcache/src/ClientProxyMembershipID.hpp
+++ b/cppcache/src/ClientProxyMembershipID.hpp
@@ -24,7 +24,7 @@
 #include <string>
 #include <vector>
 
-#include <ace/INET_Addr.h>
+#include <boost/asio.hpp>
 
 #include <geode/DataOutput.hpp>
 #include <geode/internal/functional.hpp>
@@ -46,8 +46,8 @@ class ClientProxyMembershipID : public DSMemberForVersionStamp {
 
   ClientProxyMembershipID(std::string dsName, std::string randString,
                           const std::string& hostname,
-                          const ACE_INET_Addr& address, uint32_t hostPort,
-                          const std::string& durableClientId,
+                          const boost::asio::ip::address& address,
+                          uint32_t hostPort, const std::string& durableClientId,
                           const std::chrono::seconds durableClientTimeOut =
                               std::chrono::seconds::zero());
 
@@ -73,7 +73,7 @@ class ClientProxyMembershipID : public DSMemberForVersionStamp {
   DSFid getDSFID() const override { return DSFid::InternalDistributedMember; }
   size_t objectSize() const override { return 0; }
 
-  void initHostAddressVector(const ACE_INET_Addr& address);
+  void initHostAddressVector(const boost::asio::ip::address& address);
 
   void initHostAddressVector(const uint8_t* hostAddr, uint32_t hostAddrLen);
 
@@ -84,13 +84,13 @@ class ClientProxyMembershipID : public DSMemberForVersionStamp {
                       int8_t splitBrainFlag, const char* dsname,
                       const char* uniqueTag, uint32_t vmViewId);
 
-  std::string getDSName() const { return m_dsname; }
-  std::string getUniqueTag() const { return m_uniqueTag; }
-  const std::vector<uint8_t>& getHostAddr() const { return m_hostAddr; }
+  std::string getDSName() const { return dsName_; }
+  std::string getUniqueTag() const { return uniqueTag_; }
+  const std::vector<uint8_t>& getHostAddr() const { return hostAddr_; }
   uint32_t getHostAddrLen() const {
-    return static_cast<uint32_t>(m_hostAddr.size());
+    return static_cast<uint32_t>(hostAddr_.size());
   }
-  uint32_t getHostPort() const { return m_hostPort; }
+  uint32_t getHostPort() const { return hostPort_; }
   std::string getHashKey() override;
   int16_t compareTo(const DSMemberForVersionStamp&) const override;
   int32_t hashcode() const override {
@@ -98,10 +98,10 @@ class ClientProxyMembershipID : public DSMemberForVersionStamp {
     std::stringstream hostAddressString;
     hostAddressString << std::hex;
     for (uint32_t i = 0; i < getHostAddrLen(); i++) {
-      hostAddressString << ":" << static_cast<int>(m_hostAddr[i]);
+      hostAddressString << ":" << static_cast<int>(hostAddr_[i]);
     }
     result += internal::geode_hash<std::string>{}(hostAddressString.str());
-    result += m_hostPort;
+    result += hostPort_;
     return result;
   }
 
@@ -113,24 +113,24 @@ class ClientProxyMembershipID : public DSMemberForVersionStamp {
   Serializable* readEssentialData(DataInput& input);
 
  private:
-  std::string m_memIDStr;
-  std::string m_dsmemIDStr;
-  std::string clientID;
+  void readVersion(int flags, DataInput& input);
+  void readAdditionalData(DataInput& input);
+
+ private:
+  std::string memIdStr_;
+  std::string clientId_;
+
+  std::string dsName_;
+  uint32_t hostPort_;
+  std::vector<uint8_t> hostAddr_;
 
-  std::string m_dsname;
-  uint32_t m_hostPort;
-  std::vector<uint8_t> m_hostAddr;
+  std::string uniqueTag_;
+  std::string hashKey_;
+  uint32_t vmViewId_;
 
-  std::string m_uniqueTag;
-  std::string m_hashKey;
-  uint32_t m_vmViewId;
   static const uint8_t LONER_DM_TYPE = 13;
   static const int VERSION_MASK;
   static const int8_t TOKEN_ORDINAL;
-
-  void readVersion(int flags, DataInput& input);
-
-  void readAdditionalData(DataInput& input);
 };
 
 }  // namespace client
diff --git a/cppcache/src/ClientProxyMembershipIDFactory.cpp b/cppcache/src/ClientProxyMembershipIDFactory.cpp
index 43f41cb..3f565c7 100644
--- a/cppcache/src/ClientProxyMembershipIDFactory.cpp
+++ b/cppcache/src/ClientProxyMembershipIDFactory.cpp
@@ -18,14 +18,15 @@
 #include "ClientProxyMembershipIDFactory.hpp"
 
 #include <algorithm>
-#include <iterator>
 #include <random>
 
-#include <boost/asio/ip/host_name.hpp>
+#include <boost/asio.hpp>
 #include <boost/process/environment.hpp>
 
 #include "util/Log.hpp"
 
+namespace bip = boost::asio::ip;
+
 namespace apache {
 namespace geode {
 namespace client {
@@ -56,8 +57,13 @@ ClientProxyMembershipIDFactory::ClientProxyMembershipIDFactory(
 std::unique_ptr<ClientProxyMembershipID> ClientProxyMembershipIDFactory::create(
     const std::string& durableClientId,
     const std::chrono::seconds durableClntTimeOut) {
-  const auto hostname = boost::asio::ip::host_name();
-  const ACE_INET_Addr address("", hostname.c_str(), "tcp");
+  auto hostname = bip::host_name();
+
+  boost::asio::io_service svc;
+  bip::tcp::resolver resolver{svc};
+  auto results = resolver.resolve(hostname, "0");
+  auto address = results->endpoint().address();
+
   return std::unique_ptr<ClientProxyMembershipID>(
       new ClientProxyMembershipID(dsName_, randString_, hostname, address, 0,
                                   durableClientId, durableClntTimeOut));
diff --git a/cppcache/src/PoolFactory.cpp b/cppcache/src/PoolFactory.cpp
index e769d1b..8a3c2e5 100644
--- a/cppcache/src/PoolFactory.cpp
+++ b/cppcache/src/PoolFactory.cpp
@@ -302,27 +302,6 @@ std::shared_ptr<Pool> PoolFactory::create(std::string name) {
   return std::move(poolDM);
 }
 
-PoolFactory& PoolFactory::addCheck(const std::string& host, int port) {
-  if (m_attrs->getSniProxyHost().empty()) {
-    if (port <= 0) {
-      throw IllegalArgumentException("port must be greater than 0 but was " +
-                                     std::to_string(port));
-    }
-
-    ACE_INET_Addr addr(port, host.c_str());
-#ifdef WITH_IPV6
-    // check unknown host
-    // ACE will not initialize port if hostname is not resolved.
-    if (port != addr.get_port_number()) {
-#else
-    if (!(addr.get_ip_address())) {
-#endif
-      throw IllegalArgumentException("Unknown host " + host);
-    }
-  }
-  return *this;
-}
-
 }  // namespace client
 }  // namespace geode
 }  // namespace apache
diff --git a/cppcache/src/Utils.cpp b/cppcache/src/Utils.cpp
index 86b7366..7a42d49 100644
--- a/cppcache/src/Utils.cpp
+++ b/cppcache/src/Utils.cpp
@@ -22,8 +22,6 @@
 #include <cstdlib>
 #include <iomanip>
 
-#include <ace/INET_Addr.h>
-#include <ace/OS.h>
 #include <boost/asio.hpp>
 #include <boost/dll/import.hpp>
 #include <boost/dll/runtime_symbol_info.hpp>
@@ -31,6 +29,10 @@
 
 #include "config.h"
 
+#if defined(HAVE_uname)
+#include <sys/utsname.h>
+#endif
+
 namespace apache {
 namespace geode {
 namespace client {
@@ -81,43 +83,36 @@ void Utils::parseEndpointString(const char* endpoints, std::string& host,
   port = atoi(endpointsStr.c_str());
 }
 
-std::string Utils::convertHostToCanonicalForm(const char* endpoints) {
-  if (endpoints == nullptr) return nullptr;
-  std::string hostString("");
-  uint16_t port = 0;
-  std::string endpointsStr(endpoints);
-  std::string endpointsStr1(endpoints);
-  // Parse this string to get all hostnames and port numbers.
-  std::string endpoint;
-  std::string::size_type length = endpointsStr.size();
-  std::string::size_type pos = 0;
-  ACE_TCHAR hostName[256];
-  pos = endpointsStr.find(':', 0);
-  if (pos != std::string::npos) {
-    endpoint = endpointsStr.substr(0, pos);
-    pos += 1;  // skip ':'
-    length -= (pos);
-    endpointsStr = endpointsStr.substr(pos, length);
-  } else {
-    hostString = "";
-    return "";
+std::string Utils::convertHostToCanonicalForm(const std::string& endpoints) {
+  using boost::asio::io_service;
+  using boost::asio::ip::tcp;
+
+  if (endpoints.empty()) {
+    return {};
   }
-  hostString = endpoint;
-  port = std::stoi(endpointsStr);
-  if (hostString == "localhost") {
-    auto hostname = boost::asio::ip::host_name();
-    if (auto host = ::gethostbyname(hostname.c_str())) {
-      return std::string{host->h_name} + ':' + std::to_string(port);
-    }
-  } else {
-    pos = endpointsStr1.find('.', 0);
-    if (pos != std::string::npos) {
-      ACE_INET_Addr addr(endpoints);
-      addr.get_host_name(hostName, 256);
-      return std::string(hostName) + ":" + std::to_string(port);
-    }
+
+  auto pos = endpoints.rfind(':');
+  if (pos == std::string::npos) {
+    return {};
   }
-  return endpoints;
+
+  auto hostname = endpoints.substr(0, pos);
+  auto port = endpoints.substr(pos + 1);
+
+  if (hostname == "localhost") {
+    hostname = boost::asio::ip::host_name();
+  }
+
+  io_service svc;
+  boost::system::error_code ec;
+  tcp::resolver resolver{svc};
+  auto results = resolver.resolve(hostname, ec);
+
+  if (!ec) {
+    hostname = results->host_name();
+  }
+
+  return hostname + ':' + port;
 }
 
 void Utils::parseEndpointNamesString(
diff --git a/cppcache/src/Utils.hpp b/cppcache/src/Utils.hpp
index 5643243..0bfdc15 100644
--- a/cppcache/src/Utils.hpp
+++ b/cppcache/src/Utils.hpp
@@ -156,7 +156,7 @@ class APACHE_GEODE_EXPORT Utils {
   static void parseEndpointString(const char* endpoints, std::string& host,
                                   uint16_t& port);
 
-  static std::string convertHostToCanonicalForm(const char* endpoints);
+  static std::string convertHostToCanonicalForm(const std::string& endpoints);
 
   static std::string getSystemInfo();
 
diff --git a/cppcache/src/statistics/HostStatSampler.cpp b/cppcache/src/statistics/HostStatSampler.cpp
index 500c6c6..e9d8b53 100644
--- a/cppcache/src/statistics/HostStatSampler.cpp
+++ b/cppcache/src/statistics/HostStatSampler.cpp
@@ -17,7 +17,6 @@
 
 #include "HostStatSampler.hpp"
 
-#include <algorithm>
 #include <chrono>
 #include <map>
 #include <thread>
@@ -36,11 +35,8 @@
 #include "../AdminRegion.hpp"
 #include "../CacheImpl.hpp"
 #include "../ClientHealthStats.hpp"
-#include "../ClientProxyMembershipID.hpp"
 #include "../CppCacheLibrary.hpp"
-#include "../DistributedSystem.hpp"
 #include "../TcrConnectionManager.hpp"
-#include "../util/Log.hpp"
 #include "GeodeStatisticsFactory.hpp"
 #include "StatArchiveWriter.hpp"
 
@@ -71,10 +67,10 @@ HostStatSampler::HostStatSampler(boost::filesystem::path filePath,
 
     : HostStatSampler(std::move(filePath), sampleRate, statFileLimit,
                       statDiskSpaceLimit) {
-  m_cache = cache;
-  m_samplerStats = std::unique_ptr<StatSamplerStats>(
+  cache_ = cache;
+  samplerStats_ = std::unique_ptr<StatSamplerStats>(
       new StatSamplerStats(statMngr->getStatisticsFactory()));
-  m_statMngr = statMngr;
+  statsMgr_ = statMngr;
 
   initStatDiskSpaceEnabled();
 }
@@ -83,36 +79,36 @@ HostStatSampler::HostStatSampler(boost::filesystem::path filePath,
                                  std::chrono::milliseconds sampleRate,
                                  size_t statFileLimit,
                                  size_t statDiskSpaceLimit)
-    : m_adminError(false),
-      m_running(false),
-      m_stopRequested(false),
-      m_isStatDiskSpaceEnabled(statDiskSpaceLimit != 0),
-      m_archiveFileName(std::move(filePath)),
-      m_archiveFileSizeLimit(
-          std::min(statFileLimit * mebibyte, MAX_STATS_FILE_LIMIT)),
-      m_archiveDiskSpaceLimit(statDiskSpaceLimit * mebibyte),
-      m_spaceUsed(0),
-      m_sampleRate(sampleRate),
-      m_pid(boost::this_process::get_id()),
-      m_startTime(system_clock::now()),
-      m_rollIndex(0) {
-  if (m_isStatDiskSpaceEnabled) {
-    if (m_archiveFileSizeLimit == 0 ||
-        m_archiveFileSizeLimit > m_archiveDiskSpaceLimit) {
-      m_archiveFileSizeLimit = m_archiveDiskSpaceLimit;
+    : adminError_(false),
+      running_(false),
+      stopRequested_(false),
+      isStatDiskSpaceEnabled_(statDiskSpaceLimit != 0),
+      archiveFileName_(std::move(filePath)),
+      archiveFileSizeLimit_(
+          (std::min)(statFileLimit * mebibyte, MAX_STATS_FILE_LIMIT)),
+      archiveDiskSpaceLimit_(statDiskSpaceLimit * mebibyte),
+      spaceUsed_(0),
+      sampleRate_(sampleRate),
+      pid_(boost::this_process::get_id()),
+      startTime_(system_clock::now()),
+      rollIndex_(0) {
+  if (isStatDiskSpaceEnabled_) {
+    if (archiveFileSizeLimit_ == 0 ||
+        archiveFileSizeLimit_ > archiveDiskSpaceLimit_) {
+      archiveFileSizeLimit_ = archiveDiskSpaceLimit_;
     }
   }
 }
 
 void HostStatSampler::initStatDiskSpaceEnabled() {
-  if (m_isStatDiskSpaceEnabled) {
+  if (isStatDiskSpaceEnabled_) {
     initStatFileWithExt();
 
     initRollIndex();
 
-    auto exists = boost::filesystem::exists(m_archiveFileName);
-    if (exists && m_archiveFileSizeLimit > 0) {
-      changeArchive(m_archiveFileName);
+    auto exists = boost::filesystem::exists(archiveFileName_);
+    if (exists && archiveFileSizeLimit_ > 0) {
+      changeArchive(archiveFileName_);
     } else {
       writeGfs();
     }
@@ -122,7 +118,7 @@ void HostStatSampler::initStatDiskSpaceEnabled() {
 void HostStatSampler::initRollIndex() {
   forEachIndexStatFile(
       [&](const int32_t index, const boost::filesystem::path&) {
-        m_rollIndex = std::max(m_rollIndex, index + 1);
+        rollIndex_ = (std::max)(rollIndex_, index + 1);
       });
 }
 
@@ -133,57 +129,57 @@ boost::filesystem::path HostStatSampler::initStatFileWithExt() {
 HostStatSampler::~HostStatSampler() noexcept = default;
 
 const boost::filesystem::path& HostStatSampler::createArchiveFilename() {
-  if (!m_isStatDiskSpaceEnabled) {
+  if (!isStatDiskSpaceEnabled_) {
     const auto pid = std::to_string(boost::this_process::get_id());
 
-    if (!m_archiveFileName.has_extension()) {
-      m_archiveFileName += "-" + pid;
+    if (!archiveFileName_.has_extension()) {
+      archiveFileName_ += "-" + pid;
     } else {
-      m_archiveFileName = m_archiveFileName.parent_path() /
-                          m_archiveFileName.stem() += "-" + pid;
+      archiveFileName_ =
+          archiveFileName_.parent_path() / archiveFileName_.stem() += "-" + pid;
     }
-    m_archiveFileName += GFS_EXTENSION;
+    archiveFileName_ += GFS_EXTENSION;
   }
 
-  return m_archiveFileName;
+  return archiveFileName_;
 }
 
 const boost::filesystem::path& HostStatSampler::getArchiveFilename() const {
-  return m_archiveFileName;
+  return archiveFileName_;
 }
 
 size_t HostStatSampler::getArchiveFileSizeLimit() const {
-  return m_archiveFileSizeLimit;
+  return archiveFileSizeLimit_;
 }
 
 size_t HostStatSampler::getArchiveDiskSpaceLimit() const {
-  return m_archiveDiskSpaceLimit;
+  return archiveDiskSpaceLimit_;
 }
 
 std::chrono::milliseconds HostStatSampler::getSampleRate() const {
-  return m_sampleRate;
+  return sampleRate_;
 }
 
 void HostStatSampler::accountForTimeSpentWorking(int64_t nanosSpentWorking) {
-  m_samplerStats->tookSample(nanosSpentWorking);
+  samplerStats_->tookSample(nanosSpentWorking);
 }
 
 std::recursive_mutex& HostStatSampler::getStatListMutex() {
-  return m_statMngr->getListMutex();
+  return statsMgr_->getListMutex();
 }
 
 std::vector<Statistics*>& HostStatSampler::getStatistics() {
-  return m_statMngr->getStatsList();
+  return statsMgr_->getStatsList();
 }
 
 std::vector<Statistics*>& HostStatSampler::getNewStatistics() {
-  return m_statMngr->getNewlyAddedStatsList();
+  return statsMgr_->getNewlyAddedStatsList();
 }
 
-int64_t HostStatSampler::getSystemId() { return m_pid; }
+int64_t HostStatSampler::getSystemId() { return pid_; }
 
 system_clock::time_point HostStatSampler::getSystemStartTime() {
-  return m_startTime;
+  return startTime_;
 }
 
 const std::string& HostStatSampler::getSystemDirectoryPath() {
@@ -197,19 +193,19 @@ const std::string& HostStatSampler::getProductDescription() const {
 void HostStatSampler::changeArchive(boost::filesystem::path filename) {
   if (filename.empty()) {
     // terminate the sampling thread
-    m_stopRequested = true;
+    stopRequested_ = true;
     return;
   }
 
   filename = chkForGFSExt(filename);
 
-  if (m_archiver) {
-    m_archiver->closeFile();
+  if (archiver_) {
+    archiver_->closeFile();
   }
 
   rollArchive(filename);
 
-  m_archiver.reset(new StatArchiveWriter(filename.string(), this, m_cache));
+  archiver_.reset(new StatArchiveWriter(filename.string(), this, cache_));
 }
 
 boost::filesystem::path HostStatSampler::chkForGFSExt(
@@ -219,7 +215,7 @@ boost::filesystem::path HostStatSampler::chkForGFSExt(
   }
 
   auto tmp = filename;
-  if (m_isStatDiskSpaceEnabled) {
+  if (isStatDiskSpaceEnabled_) {
     return tmp += GFS_EXTENSION;
   }
   return tmp.replace_extension(GFS_EXTENSION);
@@ -239,7 +235,7 @@ void HostStatSampler::rollArchive(const boost::filesystem::path& filename) {
   while (true) {
     auto newFilename = filename.parent_path() / filename.stem();
     newFilename += "-";
-    newFilename += std::to_string(m_rollIndex++);
+    newFilename += std::to_string(rollIndex_++);
     newFilename += extension;
 
     if (boost::filesystem::exists(newFilename)) {
@@ -252,24 +248,24 @@ void HostStatSampler::rollArchive(const boost::filesystem::path& filename) {
 }
 
 void HostStatSampler::start() {
-  if (!m_running.exchange(true)) {
-    m_thread = std::thread(&HostStatSampler::svc, this);
+  if (!running_.exchange(true)) {
+    thread_ = std::thread(&HostStatSampler::svc, this);
   }
 }
 
 void HostStatSampler::stop() {
-  m_stopRequested = true;
-  m_thread.join();
+  stopRequested_ = true;
+  thread_.join();
 }
 
-bool HostStatSampler::isRunning() const { return m_running; }
+bool HostStatSampler::isRunning() const { return running_; }
 
 void HostStatSampler::putStatsInAdminRegion() {
   try {
     // Get Values of gets, puts,misses,listCalls,numThreads
     static bool initDone = false;
     static std::string clientId = "";
-    auto adminRgn = m_statMngr->getAdminRegion();
+    auto adminRgn = statsMgr_->getAdminRegion();
     if (adminRgn == nullptr) return;
     auto conn_man = adminRgn->getConnectionManager();
     if (conn_man->isNetDown()) {
@@ -286,7 +282,7 @@ void HostStatSampler::putStatsInAdminRegion() {
         int puts = 0, gets = 0, misses = 0, numListeners = 0, numThreads = 0,
             creates = 0;
         int64_t cpuTime = 0;
-        auto gf = m_statMngr->getStatisticsFactory();
+        auto gf = statsMgr_->getStatisticsFactory();
         if (gf) {
           const auto cacheStatType = gf->findType("CachePerfStats");
           if (cacheStatType) {
@@ -309,7 +305,7 @@ void HostStatSampler::putStatsInAdminRegion() {
         if (clientId.empty()) {
           auto memId = conn_man->getCacheImpl()
                            ->getClientProxyMembershipIDFactory()
-                           .create(m_durableClientId, m_durableTimeout);
+                           .create(durableClientId_, durableTimeout_);
           clientId = memId->getDSMemberIdForThinClientUse();
         }
 
@@ -318,7 +314,7 @@ void HostStatSampler::putStatsInAdminRegion() {
       }
     }
   } catch (const Exception&) {
-    m_adminError = true;
+    adminError_ = true;
   }
 }
 
@@ -328,54 +324,53 @@ void HostStatSampler::writeGfs() {
 }
 
 void HostStatSampler::forceSample() {
-  std::lock_guard<decltype(m_samplingLock)> guard(m_samplingLock);
+  std::lock_guard<decltype(samplingMutex_)> guard(samplingMutex_);
 
-  if (m_archiver) {
-    m_archiver->sample();
-    m_archiver->flush();
+  if (archiver_) {
+    archiver_->sample();
+    archiver_->flush();
   }
 }
 
 void HostStatSampler::doSample(const boost::filesystem::path& archiveFilename) {
-  std::lock_guard<decltype(m_samplingLock)> guard(m_samplingLock);
+  std::lock_guard<decltype(samplingMutex_)> guard(samplingMutex_);
 
-  if (!m_adminError) {
+  if (!adminError_) {
     putStatsInAdminRegion();
   }
 
-  if (m_archiver) {
-    m_archiver->sample();
+  if (archiver_) {
+    archiver_->sample();
 
-    if (m_archiveFileSizeLimit != 0) {
-      auto size = m_archiver->getSampleSize();
-      auto bytesWritten = m_archiver->bytesWritten();
-      if (bytesWritten > (m_archiveFileSizeLimit - size)) {
+    if (archiveFileSizeLimit_ != 0) {
+      auto size = archiver_->getSampleSize();
+      auto bytesWritten = archiver_->bytesWritten();
+      if (bytesWritten > (archiveFileSizeLimit_ - size)) {
         // roll the archive
         changeArchive(archiveFilename);
       }
     }
-    m_spaceUsed += m_archiver->bytesWritten();
+    spaceUsed_ += archiver_->bytesWritten();
     // delete older stat files if disk limit is about to be exceeded.
-    if ((m_archiveDiskSpaceLimit != 0) &&
-        (m_spaceUsed >=
-         (m_archiveDiskSpaceLimit - m_archiver->getSampleSize()))) {
+    if ((archiveDiskSpaceLimit_ != 0) &&
+        (spaceUsed_ >= (archiveDiskSpaceLimit_ - archiver_->getSampleSize()))) {
       checkDiskLimit();
     }
 
     // It will flush the contents to the archive file, in every
     // sample run.
 
-    m_archiver->flush();
+    archiver_->flush();
   }
 }
 
 template <typename _Function>
 void HostStatSampler::forEachIndexStatFile(_Function function) const {
-  const boost::regex statsFilter(m_archiveFileName.stem().string() +
+  const boost::regex statsFilter(archiveFileName_.stem().string() +
                                  R"(-([\d]+))" +
-                                 m_archiveFileName.extension().string());
+                                 archiveFileName_.extension().string());
 
-  auto dir = m_archiveFileName.parent_path();
+  auto dir = archiveFileName_.parent_path();
   if (dir.empty()) {
     dir = boost::filesystem::current_path();
   }
@@ -398,27 +393,27 @@ void HostStatSampler::forEachIndexStatFile(_Function function) const {
 }
 
 void HostStatSampler::checkDiskLimit() {
-  m_spaceUsed = 0;
+  spaceUsed_ = 0;
 
   std::map<int32_t, std::pair<boost::filesystem::path, size_t>> indexedFiles;
   forEachIndexStatFile(
       [&](const int32_t index, const boost::filesystem::path& file) {
         const auto size = boost::filesystem::file_size(file);
         indexedFiles.emplace(index, std::make_pair(file, size));
-        m_spaceUsed += size;
+        spaceUsed_ += size;
       });
 
-  if (m_archiver) {
-    m_spaceUsed += m_archiver->bytesWritten();
+  if (archiver_) {
+    spaceUsed_ += archiver_->bytesWritten();
   }
 
   for (const auto& i : indexedFiles) {
-    if (m_spaceUsed > m_archiveDiskSpaceLimit) {
+    if (spaceUsed_ > archiveDiskSpaceLimit_) {
       const auto& file = i.second.first;
       const auto size = i.second.second;
       try {
         boost::filesystem::remove(file);
-        m_spaceUsed -= size;
+        spaceUsed_ -= size;
       } catch (boost::filesystem::filesystem_error& e) {
         LOGWARN("Could not delete " + file.string() + ": " + e.what());
       }
@@ -433,13 +428,13 @@ void HostStatSampler::svc(void) {
     // for the first time the sampler needs to add the pid to the filename
     // passed to it.
     auto archiveFilename = createArchiveFilename();
-    if (!m_isStatDiskSpaceEnabled) {
+    if (!isStatDiskSpaceEnabled_) {
       changeArchive(archiveFilename);
     }
     auto samplingRate = milliseconds(getSampleRate());
     bool gotexception = false;
     int waitTime = 0;
-    while (!m_stopRequested) {
+    while (!stopRequested_) {
       try {
         if (gotexception) {
           std::this_thread::sleep_for(std::chrono::seconds(1));
@@ -465,7 +460,7 @@ void HostStatSampler::svc(void) {
         auto sleepDuration =
             samplingRate - duration_cast<milliseconds>(spentWorking);
         static const auto wakeInterval = milliseconds(100);
-        while (!m_stopRequested && sleepDuration > milliseconds::zero()) {
+        while (!stopRequested_ && sleepDuration > milliseconds::zero()) {
           std::this_thread::sleep_for(
               sleepDuration > wakeInterval ? wakeInterval : sleepDuration);
           sleepDuration -= wakeInterval;
@@ -481,9 +476,9 @@ void HostStatSampler::svc(void) {
         gotexception = true;
       }
     }
-    m_samplerStats->close();
-    if (m_archiver != nullptr) {
-      m_archiver->close();
+    samplerStats_->close();
+    if (archiver_ != nullptr) {
+      archiver_->close();
     }
   } catch (Exception& e) {
     // log the exception and let the thread exit.
@@ -494,7 +489,7 @@ void HostStatSampler::svc(void) {
        LOGERROR("Exception in sampler thread ");
        closeSpecialStats();
    }*/
-  m_running = false;
+  running_ = false;
 }
 
 }  // namespace statistics
diff --git a/cppcache/src/statistics/HostStatSampler.hpp b/cppcache/src/statistics/HostStatSampler.hpp
index ba3523a..1457050 100644
--- a/cppcache/src/statistics/HostStatSampler.hpp
+++ b/cppcache/src/statistics/HostStatSampler.hpp
@@ -161,28 +161,6 @@ class HostStatSampler {
   bool isRunning() const;
 
  private:
-  std::recursive_mutex m_samplingLock;
-  bool m_adminError;
-  std::thread m_thread;
-  std::atomic<bool> m_running;
-  std::atomic<bool> m_stopRequested;
-  std::atomic<bool> m_isStatDiskSpaceEnabled;
-  std::unique_ptr<StatArchiveWriter> m_archiver;
-  std::unique_ptr<StatSamplerStats> m_samplerStats;
-  const char* m_durableClientId;
-  std::chrono::seconds m_durableTimeout;
-
-  boost::filesystem::path m_archiveFileName;
-  size_t m_archiveFileSizeLimit;
-  size_t m_archiveDiskSpaceLimit;
-  size_t m_spaceUsed = 0;
-  std::chrono::milliseconds m_sampleRate;
-  StatisticsManager* m_statMngr;
-  CacheImpl* m_cache;
-
-  int64_t m_pid;
-  system_clock::time_point m_startTime;
-
   /**
    * For testing only.
    */
@@ -192,12 +170,7 @@ class HostStatSampler {
 
   boost::filesystem::path initStatFileWithExt();
 
-  /**
-   * The archiveFile, after it exceeds archiveFileSizeLimit should be rolled
-   * to a new file name. This integer rollIndex will be used to format the
-   * file name into which the current archiveFile will be renamed.
-   */
-  int32_t m_rollIndex;
+
 
   /**
    * This function rolls the existing archive file.
@@ -219,13 +192,42 @@ class HostStatSampler {
 
   void initStatDiskSpaceEnabled();
 
-  static const char* NC_HSS_Thread;
 
   friend TestableHostStatSampler;
   void initRollIndex();
 
   template <typename _Function>
   void forEachIndexStatFile(_Function function) const;
+
+ private:
+  std::recursive_mutex samplingMutex_;
+  bool adminError_;
+  std::thread thread_;
+  std::atomic<bool> running_;
+  std::atomic<bool> stopRequested_;
+  std::atomic<bool> isStatDiskSpaceEnabled_;
+  std::unique_ptr<StatArchiveWriter> archiver_;
+  std::unique_ptr<StatSamplerStats> samplerStats_;
+  const char* durableClientId_;
+  std::chrono::seconds durableTimeout_;
+
+  boost::filesystem::path archiveFileName_;
+  size_t archiveFileSizeLimit_;
+  size_t archiveDiskSpaceLimit_;
+  size_t spaceUsed_ = 0;
+  std::chrono::milliseconds sampleRate_;
+  StatisticsManager* statsMgr_;
+  CacheImpl* cache_;
+
+  int64_t pid_;
+  system_clock::time_point startTime_;
+
+  /**
+   * The archiveFile, after it exceeds archiveFileSizeLimit should be rolled
+   * to a new file name. This integer rollIndex will be used to format the
+   * file name into which the current archiveFile will be renamed.
+   */
+  int32_t rollIndex_;
 };
 
 }  // namespace statistics
diff --git a/cppcache/test/QueueConnectionRequestTest.cpp b/cppcache/test/QueueConnectionRequestTest.cpp
index 6aa11ef..7a48087 100644
--- a/cppcache/test/QueueConnectionRequestTest.cpp
+++ b/cppcache/test/QueueConnectionRequestTest.cpp
@@ -17,6 +17,7 @@
 
 #include <QueueConnectionRequest.hpp>
 
+#include <boost/asio.hpp>
 #include <boost/process/environment.hpp>
 
 #include <gtest/gtest.h>
@@ -34,8 +35,10 @@ class QueueConnectionRequestTest : public ::testing::Test,
                                    public ByteArrayFixture {};
 
 TEST_F(QueueConnectionRequestTest, testToData) {
+  namespace bip = boost::asio::ip;
+
   DataOutputInternal dataOutput;
-  ACE_INET_Addr addr(10, "localhost");
+  auto address = bip::make_address("127.0.0.1");
   ServerLocation srv("server", 10);
   std::set<ServerLocation> servLoc;
   servLoc.insert(srv);
@@ -44,7 +47,7 @@ TEST_F(QueueConnectionRequestTest, testToData) {
   const std::string hostname = "name";
   const std::string durableClientId = "id-1";
 
-  const ClientProxyMembershipID qCR(dsName, randString, hostname, addr, 10,
+  const ClientProxyMembershipID qCR(dsName, randString, hostname, address, 10,
                                     durableClientId);
 
   QueueConnectionRequest queueConnReq(qCR, servLoc, -1, false);
diff --git a/cppcache/test/statistics/HostStatSamplerTest.cpp b/cppcache/test/statistics/HostStatSamplerTest.cpp
index f3efbd8..33a23e4 100644
--- a/cppcache/test/statistics/HostStatSamplerTest.cpp
+++ b/cppcache/test/statistics/HostStatSamplerTest.cpp
@@ -66,9 +66,9 @@ class TestableHostStatSampler : public HostStatSampler {
 
   void initRollIndex() { HostStatSampler::initRollIndex(); }
 
-  int32_t getRollIndex() { return HostStatSampler::m_rollIndex; }
+  int32_t getRollIndex() { return HostStatSampler::rollIndex_; }
 
-  size_t getSpaceUsed() { return HostStatSampler::m_spaceUsed; }
+  size_t getSpaceUsed() { return HostStatSampler::spaceUsed_; }
 };
 
 TEST(HostStatSamplerTest,