This is an automated email from the ASF dual-hosted git repository.
mmartell 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 202cbe5 GEODE-7490: Support Visual Studio 2019 (#554)
202cbe5 is described below
commit 202cbe56593e916d9b8637fd9f349521cfab5141
Author: Michael Martell <[email protected]>
AuthorDate: Mon Nov 25 07:40:43 2019 -0800
GEODE-7490: Support Visual Studio 2019 (#554)
* Cleanup/improve cleanStaleStickyConnection
* Add support for VS2019 to ACE
* Update BUILDING.md for VS 2019
* Cleanup comment
---
BUILDING.md | 6 ++++
cppcache/src/ThinClientStickyManager.cpp | 62 ++++++++++++++------------------
cppcache/src/ThinClientStickyManager.hpp | 1 -
dependencies/ACE/CMakeLists.txt | 5 +--
4 files changed, 35 insertions(+), 39 deletions(-)
diff --git a/BUILDING.md b/BUILDING.md
index 7c3dd85..2f5cded 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -87,6 +87,12 @@ The recommended generator on Windows is `Visual Studio 15
2017 Win64`:
$ cmake .. -G "Visual Studio 15 2017 Win64" -Thost=x64
```
+Visual Studio 2019 is also supported. For this generator you must leave off
the Win64:
+
+```console
+$ cmake .. -G "Visual Studio 16 2019" -Thost=x64
+```
+
### Build Parallelism
For faster builds, use optional parallelism parameters in the last build step:
diff --git a/cppcache/src/ThinClientStickyManager.cpp
b/cppcache/src/ThinClientStickyManager.cpp
index 8474641..14eaf31 100644
--- a/cppcache/src/ThinClientStickyManager.cpp
+++ b/cppcache/src/ThinClientStickyManager.cpp
@@ -117,40 +117,34 @@ void
ThinClientStickyManager::setSingleHopStickyConnection(
void ThinClientStickyManager::cleanStaleStickyConnection() {
LOGDEBUG("Cleaning sticky connections");
- std::set<ServerLocation> excludeServers;
std::lock_guard<decltype(m_stickyLock)> keysGuard(m_stickyLock);
- std::find_if(m_stickyConnList.begin(), m_stickyConnList.end(),
- ThinClientStickyManager::isNULL);
- while (1) {
- std::set<TcrConnection**>::iterator it =
- std::find_if(m_stickyConnList.begin(), m_stickyConnList.end(),
- ThinClientStickyManager::isNULL);
- if (it == m_stickyConnList.end()) break;
- m_stickyConnList.erase(it);
- }
- bool maxConnLimit = false;
- for (std::set<TcrConnection**>::iterator it = m_stickyConnList.begin();
- it != m_stickyConnList.end(); it++) {
- TcrConnection** conn = (*it);
- if ((*conn)->setAndGetBeingUsed(true, false) &&
- canThisConnBeDeleted(*conn)) {
- GfErrType err = GF_NOERR;
- TcrConnection* temp = m_dm->getConnectionFromQueue(
- false, &err, excludeServers, maxConnLimit);
- if (temp) {
- TcrConnection* temp1 = *conn;
- //*conn = temp; instead of setting in thread local put in queue, thread
- // will come and pick it from there
- *conn = nullptr;
- m_dm->put(temp, false);
- temp1->close();
- _GEODE_SAFE_DELETE(temp1);
- m_dm->removeEPConnections(1, false);
- LOGDEBUG("Replaced a sticky connection");
- } else {
- (*conn)->setAndGetBeingUsed(false, false);
+
+ auto maxConnLimit = false;
+ std::set<ServerLocation> excludeServers;
+ for (auto it = m_stickyConnList.begin(); it != m_stickyConnList.end();) {
+ auto conn = (*it);
+ if (*conn) {
+ if ((*conn)->setAndGetBeingUsed(true, false) &&
+ canThisConnBeDeleted(*conn)) {
+ auto err = GF_NOERR;
+ if (auto temp = m_dm->getConnectionFromQueue(
+ false, &err, excludeServers, maxConnLimit)) {
+ auto temp1 = *conn;
+ //*conn = temp; instead of setting in thread local,
+ // put in queue, thread will come and pick it from there
+ *conn = nullptr;
+ m_dm->put(temp, false);
+ temp1->close();
+ _GEODE_SAFE_DELETE(temp1);
+ m_dm->removeEPConnections(1, false);
+ LOGDEBUG("Replaced a sticky connection");
+ } else {
+ (*conn)->setAndGetBeingUsed(false, false);
+ }
}
- temp = nullptr;
+ ++it;
+ } else {
+ it = m_stickyConnList.erase(it);
}
}
}
@@ -208,10 +202,6 @@ void
ThinClientStickyManager::releaseThreadLocalConnection() {
(*TssConnectionWrapper::s_geodeTSSConn)
->releaseSHConnections(m_dm->shared_from_this());
}
-bool ThinClientStickyManager::isNULL(TcrConnection** conn) {
- if (*conn == nullptr) return true;
- return false;
-}
void ThinClientStickyManager::getAnyConnection(TcrConnection*& conn) {
conn = (*TssConnectionWrapper::s_geodeTSSConn)
diff --git a/cppcache/src/ThinClientStickyManager.hpp
b/cppcache/src/ThinClientStickyManager.hpp
index dbb2fa7..5d3624b 100644
--- a/cppcache/src/ThinClientStickyManager.hpp
+++ b/cppcache/src/ThinClientStickyManager.hpp
@@ -56,7 +56,6 @@ class ThinClientStickyManager {
void getAnyConnection(TcrConnection*& conn);
private:
- static bool isNULL(TcrConnection** conn);
ThinClientPoolDM* m_dm;
std::set<TcrConnection**> m_stickyConnList;
std::recursive_mutex m_stickyLock;
diff --git a/dependencies/ACE/CMakeLists.txt b/dependencies/ACE/CMakeLists.txt
index 010eb7c..5357173 100644
--- a/dependencies/ACE/CMakeLists.txt
+++ b/dependencies/ACE/CMakeLists.txt
@@ -50,12 +50,13 @@ if (${WIN32})
else()
set( _PLATFORM win32 )
endif()
-
if (MSVC_VERSION EQUAL 1900)
set(_TYPE "vc14")
elseif((MSVC_VERSION GREATER_EQUAL 1910) AND (MSVC_VERSION LESS_EQUAL 1919))
set(_TYPE "vs2017")
- endIF()
+ else()
+ set(_TYPE "vs2019")
+ endif()
set ( _COMMAND_PREFIX ${CMAKE_COMMAND} -E chdir ace )