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 7661515 GEODE-9078: Remove ACE mutexes (#776)
7661515 is described below
commit 76615158194c51a4ccace652f1f93f4571c83c67
Author: Mario Salazar de Torres <[email protected]>
AuthorDate: Thu May 27 21:04:32 2021 +0200
GEODE-9078: Remove ACE mutexes (#776)
- Removed all ACE mutexes.
- Solved header inclusion leak in order to avoid linking Boost to
testobject.
- TODO. Review mutex usage in PdxType as it is only used to read, so
either it's not necessary or we are missing write locks.
- Removed testTimedSemaphore old ITs as ACE_Semaphore is not used
anymore.
- Changed member variable naming to the current standard for
AdminRegion class.
- Got rid of TryReadGuard and TryWriteGuard as it's not really
necessary. Code has been refactored so it uses plain shared_mutex
instead.
- shared_mutex from AdminRegion, RemoteQueryService and
ThinClientRegion are not publicly exposed anymore. For correctness,
locks are exposed instead.
- Reverted naming change on member variables for class AdminRegion.
- Fixed exception in .Net integration tests. An exception with message
"The string binding is invalid" was being thrown due to the fact that
the Apache.Geode DLL has mixed code and compiles with CLR enabled.
That's something dis-recommended by Boost because under certain
conditions could cause problems with boost static variables.
In this case the issue was related to one of the boost::exception
static variables.
This issue was solved by removing header inclusion introduced in
revision 3.
- Due to above issue, exposing the lock rather than the mutex is not
possible for now, until a further refactor is made to .Net code, so
mutex/lock exposition from revision 3 has been reverted.
- As it was determined, there is no need to guarantee exclusive access
to PdxTypes, so both remains of shared_lock are removed.
- Also, removed ReadWriteLock, as it's not necessary anymore.
---
cppcache/benchmark/ConnectionQueueBM.cpp | 3 -
cppcache/integration-test/CMakeLists.txt | 1 -
.../testRegionAccessThreadSafe.cpp | 14 +-
cppcache/integration-test/testTimedSemaphore.cpp | 153 ---------------------
cppcache/src/AdminRegion.cpp | 13 +-
cppcache/src/AdminRegion.hpp | 8 +-
cppcache/src/ClientMetadata.cpp | 1 -
cppcache/src/ClientMetadata.hpp | 1 -
cppcache/src/ClientMetadataService.cpp | 4 +-
cppcache/src/ClientProxyMembershipID.cpp | 1 +
cppcache/src/DataOutputInternal.hpp | 2 -
cppcache/src/LocalRegion.cpp | 89 ++++++------
cppcache/src/LocalRegion.hpp | 22 +--
cppcache/src/MemberListForVersionStamp.cpp | 6 +-
cppcache/src/MemberListForVersionStamp.hpp | 6 +-
cppcache/src/PdxType.cpp | 4 +-
cppcache/src/PdxType.hpp | 3 -
cppcache/src/PdxTypeRegistry.cpp | 31 +++--
cppcache/src/PdxTypeRegistry.hpp | 11 +-
cppcache/src/PreservedDataExpiryTask.cpp | 6 +-
cppcache/src/PutAllPartialResult.cpp | 6 +-
cppcache/src/PutAllPartialResult.hpp | 4 +-
cppcache/src/ReadWriteLock.cpp | 52 -------
cppcache/src/ReadWriteLock.hpp | 85 ------------
cppcache/src/RemoteQuery.cpp | 6 +-
cppcache/src/RemoteQueryService.cpp | 84 +++++------
cppcache/src/RemoteQueryService.hpp | 6 +-
cppcache/src/TcrMessage.cpp | 25 ++--
cppcache/src/ThinClientHARegion.cpp | 6 +-
cppcache/src/ThinClientRegion.cpp | 31 +++--
cppcache/src/ThinClientRegion.hpp | 6 +-
cppcache/src/statistics/HostStatSampler.cpp | 4 +-
cppcache/src/statistics/PoolStatsSampler.cpp | 1 -
tests/cpp/fwklib/FwkException.hpp | 6 +-
tests/cpp/testobject/ArrayOfByte.cpp | 101 ++++++++++++++
tests/cpp/testobject/ArrayOfByte.hpp | 87 +-----------
tests/cpp/testobject/CMakeLists.txt | 1 +
tests/cpp/testobject/DeltaTestImpl.cpp | 7 +-
tests/cpp/testobject/DeltaTestImpl.hpp | 5 +-
tests/cpp/testobject/NonPdxType.hpp | 1 -
40 files changed, 326 insertions(+), 577 deletions(-)
diff --git a/cppcache/benchmark/ConnectionQueueBM.cpp
b/cppcache/benchmark/ConnectionQueueBM.cpp
index 74feb66..e0fbcf9 100644
--- a/cppcache/benchmark/ConnectionQueueBM.cpp
+++ b/cppcache/benchmark/ConnectionQueueBM.cpp
@@ -20,9 +20,6 @@
#include <mutex>
#include <thread>
-#include <ace/Condition_Recursive_Thread_Mutex.h>
-#include <ace/Recursive_Thread_Mutex.h>
-
#include "ConnectionQueue.hpp"
class TestObject {
diff --git a/cppcache/integration-test/CMakeLists.txt
b/cppcache/integration-test/CMakeLists.txt
index 729a785..3284569 100644
--- a/cppcache/integration-test/CMakeLists.txt
+++ b/cppcache/integration-test/CMakeLists.txt
@@ -199,7 +199,6 @@ set_tests_properties(
testThinClientPutAllWithCallBackArgWithoutConcurrency
testThinClientSecurityCQAuthorizationMU
testThinClientTXFailover
- testTimedSemaphore
# broken
testThinClientCqDurable
testThinClientGatewayTest
diff --git a/cppcache/integration-test/testRegionAccessThreadSafe.cpp
b/cppcache/integration-test/testRegionAccessThreadSafe.cpp
index 3751fa2..52fbbe4 100644
--- a/cppcache/integration-test/testRegionAccessThreadSafe.cpp
+++ b/cppcache/integration-test/testRegionAccessThreadSafe.cpp
@@ -17,7 +17,6 @@
#include "fw_dunit.hpp"
#include "ThinClientHelper.hpp"
#include <ace/Task.h>
-#include <ace/Recursive_Thread_Mutex.h>
using apache::geode::client::Exception;
@@ -28,21 +27,20 @@ class GetRegionThread : public ACE_Task_Base {
std::string m_subPath;
bool m_regionCreateDone;
bool m_subRegionCreateDone;
- ACE_Recursive_Thread_Mutex m_mutex;
+ std::recursive_mutex mutex_;
GetRegionThread(const char *path, const char *subPath)
: m_running(false),
m_path(path),
m_subPath(subPath),
m_regionCreateDone(false),
- m_subRegionCreateDone(false),
- m_mutex() {}
+ m_subRegionCreateDone(false) {}
int svc(void) override {
while (m_running == true) {
SLEEP(40);
try {
auto rptr = getHelper()->getRegion(m_path.c_str());
if (rptr != nullptr) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_mutex);
+ std::lock_guard<decltype(mutex_)> guard{mutex_};
ASSERT(m_regionCreateDone == true, "regionCreate Not Done");
}
} catch (Exception &ex) {
@@ -58,7 +56,7 @@ class GetRegionThread : public ACE_Task_Base {
try {
auto rptr = getHelper()->getRegion(m_subPath.c_str());
if (rptr != nullptr) {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_mutex);
+ std::lock_guard<decltype(mutex_)> guard{mutex_};
ASSERT(m_subRegionCreateDone == true, "subRegionCreate Not Done");
return 0;
}
@@ -73,11 +71,11 @@ class GetRegionThread : public ACE_Task_Base {
return 0;
}
void setRegionFlag() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_mutex);
+ std::lock_guard<decltype(mutex_)> guard{mutex_};
m_regionCreateDone = true;
}
void setSubRegionFlag() {
- ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_mutex);
+ std::lock_guard<decltype(mutex_)> guard{mutex_};
m_subRegionCreateDone = true;
}
void start() {
diff --git a/cppcache/integration-test/testTimedSemaphore.cpp
b/cppcache/integration-test/testTimedSemaphore.cpp
deleted file mode 100644
index 3cdfb2d..0000000
--- a/cppcache/integration-test/testTimedSemaphore.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <iostream>
-
-#include <ace/Synch.h>
-
-#include "fw_helper.hpp"
-
-class ThreadAcquire : public ACE_Task_Base {
- public:
- ThreadAcquire(ACE_Thread_Semaphore &sema, int acquireSecs)
- : ACE_Task_Base(),
- m_sema(sema),
- m_acquireSecs(acquireSecs),
- m_status(0) {}
-
- int svc() override {
- auto start = std::chrono::steady_clock::now();
- ACE_Time_Value expireAt =
- ACE_Time_Value{time(nullptr)} + ACE_Time_Value{m_acquireSecs};
-
- std::cout << "Thread acquiring lock at "
- << std::chrono::time_point_cast<std::chrono::milliseconds>(start)
- .time_since_epoch()
- .count()
- << "msecs" << std::endl;
-
- if (m_sema.acquire(expireAt) == 0) {
- auto interval = std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::steady_clock::now() - start)
- .count();
- std::cout << "Thread acquired lock after " << interval << "msecs"
- << std::endl;
- m_status = 0;
- } else {
- auto interval = std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::steady_clock::now() - start)
- .count();
-
- std::cout << "Thread failed to acquire lock after " << interval <<
"msecs"
- << std::endl;
- m_status = -1;
- }
- return m_status;
- }
-
- int getStatus() { return m_status; }
-
- private:
- ACE_Thread_Semaphore &m_sema;
- int m_acquireSecs;
- int m_status;
-};
-
-BEGIN_TEST(CheckTimedAcquire)
- {
- ACE_Thread_Semaphore sema(1);
- ThreadAcquire *thread = new ThreadAcquire(sema, 10);
-
- sema.acquire();
- thread->activate();
-
- LOG("Sleeping for 8 secs.");
- std::this_thread::sleep_for(std::chrono::seconds(8));
- ASSERT(thread->thr_count() == 1, "Expected thread to be running.");
- sema.release();
- SLEEP(50); // Sleep for a few millis for the thread to end.
- ASSERT(thread->thr_count() == 0, "Expected no thread to be running.");
- ASSERT(thread->wait() == 0, "Expected successful end of thread.");
- ASSERT(thread->getStatus() == 0, "Expected zero exit status from thread.");
-
- delete thread;
- }
-END_TEST(CheckTimedAcquire)
-
-BEGIN_TEST(CheckTimedAcquireFail)
- {
- ACE_Thread_Semaphore sema(0);
- ThreadAcquire *thread = new ThreadAcquire(sema, 10);
-
- thread->activate();
-
- LOG("Sleeping for 8 secs.");
- std::this_thread::sleep_for(std::chrono::seconds(8));
- ASSERT(thread->thr_count() == 1, "Expected thread to be running.");
- std::this_thread::sleep_for(std::chrono::seconds(3));
- ASSERT(thread->thr_count() == 0, "Expected no thread to be running.");
- ASSERT(thread->wait() == 0, "Expected successful end of thread.");
- ASSERT(thread->getStatus() == -1,
- "Expected non-zero exit status from thread.");
-
- delete thread;
- }
-END_TEST(CheckTimedAcquireFail)
-
-BEGIN_TEST(CheckNoWait)
- {
- ACE_Thread_Semaphore sema(0);
- ThreadAcquire *thread = new ThreadAcquire(sema, 10);
-
- sema.release();
- thread->activate();
-
- std::this_thread::sleep_for(std::chrono::seconds(1));
- ASSERT(thread->thr_count() == 0, "Expected no thread to be running.");
- ASSERT(thread->wait() == 0, "Expected successful end of thread.");
- ASSERT(thread->getStatus() == 0, "Expected zero exit status from thread.");
-
- delete thread;
- }
-END_TEST(CheckNoWait)
-
-BEGIN_TEST(CheckResetAndTimedAcquire)
- {
- ACE_Thread_Semaphore sema(1);
- ThreadAcquire *thread = new ThreadAcquire(sema, 10);
-
- sema.acquire();
- std::this_thread::sleep_for(std::chrono::seconds(1));
- sema.release();
- sema.release();
- sema.release();
- while (sema.tryacquire() != -1) {
- }
- thread->activate();
-
- LOG("Sleeping for 8 secs.");
- std::this_thread::sleep_for(std::chrono::seconds(8));
- ASSERT(thread->thr_count() == 1, "Expected thread to be running.");
- sema.release();
- SLEEP(50); // Sleep for a few millis for the thread to end.
- ASSERT(thread->thr_count() == 0, "Expected no thread to be running.");
- ASSERT(thread->wait() == 0, "Expected successful end of thread.");
- ASSERT(thread->getStatus() == 0, "Expected zero exit status from thread.");
-
- delete thread;
- }
-END_TEST(CheckResetAndTimedAcquire)
diff --git a/cppcache/src/AdminRegion.cpp b/cppcache/src/AdminRegion.cpp
index cae6df3..87b7963 100644
--- a/cppcache/src/AdminRegion.cpp
+++ b/cppcache/src/AdminRegion.cpp
@@ -17,6 +17,8 @@
#include "AdminRegion.hpp"
+#include <boost/thread/lock_types.hpp>
+
#include <geode/SystemProperties.hpp>
#include "CacheImpl.hpp"
@@ -114,15 +116,17 @@ GfErrType AdminRegion::putNoThrow(const
std::shared_ptr<CacheableKey>& keyPtr,
}
void AdminRegion::close() {
- TryWriteGuard _guard(m_rwLock, m_destroyPending);
+ boost::unique_lock<decltype(m_rwMutex)> guard{m_rwMutex};
+
if (m_destroyPending) {
return;
}
+
m_destroyPending = true;
// Close distribution manager if it is not a pool
- ThinClientPoolDM* pool = dynamic_cast<ThinClientPoolDM*>(m_distMngr);
- if (pool == nullptr) {
+ if (m_distMngr != nullptr &&
+ dynamic_cast<ThinClientPoolDM*>(m_distMngr) == nullptr) {
m_distMngr->destroy();
_GEODE_SAFE_DELETE(m_distMngr);
}
@@ -136,7 +140,8 @@ AdminRegion::~AdminRegion() {
}
const bool& AdminRegion::isDestroyed() { return m_destroyPending; }
-ACE_RW_Thread_Mutex& AdminRegion::getRWLock() { return m_rwLock; }
+
+boost::shared_mutex& AdminRegion::getMutex() { return m_rwMutex; }
} // namespace client
} // namespace geode
diff --git a/cppcache/src/AdminRegion.hpp b/cppcache/src/AdminRegion.hpp
index 6aa8903..d5e68a9 100644
--- a/cppcache/src/AdminRegion.hpp
+++ b/cppcache/src/AdminRegion.hpp
@@ -23,11 +23,11 @@
#include <memory>
#include <string>
+#include <boost/thread/shared_mutex.hpp>
+
#include <geode/Serializable.hpp>
#include "ErrType.hpp"
-#include "ReadWriteLock.hpp"
-
namespace apache {
namespace geode {
@@ -48,7 +48,7 @@ class AdminRegion : public
std::enable_shared_from_this<AdminRegion> {
ThinClientBaseDM* m_distMngr;
std::string m_fullPath;
TcrConnectionManager* m_connectionMgr;
- ACE_RW_Thread_Mutex m_rwLock;
+ boost::shared_mutex m_rwMutex;
bool m_destroyPending;
GfErrType putNoThrow(const std::shared_ptr<CacheableKey>& keyPtr,
@@ -67,7 +67,7 @@ class AdminRegion : public
std::enable_shared_from_this<AdminRegion> {
static std::shared_ptr<AdminRegion> create(
CacheImpl* cache, ThinClientBaseDM* distMan = nullptr);
- ACE_RW_Thread_Mutex& getRWLock();
+ boost::shared_mutex& getMutex();
const bool& isDestroyed();
void close();
void init();
diff --git a/cppcache/src/ClientMetadata.cpp b/cppcache/src/ClientMetadata.cpp
index a160af1..83a30e7 100644
--- a/cppcache/src/ClientMetadata.cpp
+++ b/cppcache/src/ClientMetadata.cpp
@@ -164,7 +164,6 @@ void ClientMetadata::getServerLocation(
void ClientMetadata::updateBucketServerLocations(
int bucketId, BucketServerLocationsType bucketServerLocations) {
- // WriteGuard guard( m_readWriteLock );
checkBucketId(bucketId);
auto&& serverGroup = m_tcrdm->getServerGroup();
diff --git a/cppcache/src/ClientMetadata.hpp b/cppcache/src/ClientMetadata.hpp
index 735078e..133c629 100644
--- a/cppcache/src/ClientMetadata.hpp
+++ b/cppcache/src/ClientMetadata.hpp
@@ -27,7 +27,6 @@
#include "BucketServerLocation.hpp"
#include "FixedPartitionAttributesImpl.hpp"
-#include "ReadWriteLock.hpp"
#include "ServerLocation.hpp"
#include "util/Log.hpp"
diff --git a/cppcache/src/ClientMetadataService.cpp
b/cppcache/src/ClientMetadataService.cpp
index 42f422f..8c38ae4 100644
--- a/cppcache/src/ClientMetadataService.cpp
+++ b/cppcache/src/ClientMetadataService.cpp
@@ -308,8 +308,8 @@ void ClientMetadataService::enqueueForMetadataRefresh(
if (region != nullptr) {
auto tcrRegion = dynamic_cast<ThinClientRegion*>(region.get());
{
- TryWriteGuard guardRegionMetaDataRefresh(
- tcrRegion->getMataDataMutex(), tcrRegion->getMetaDataRefreshed());
+ boost::unique_lock<boost::shared_mutex> guard{
+ tcrRegion->getMetadataMutex()};
if (tcrRegion->getMetaDataRefreshed()) {
return;
}
diff --git a/cppcache/src/ClientProxyMembershipID.cpp
b/cppcache/src/ClientProxyMembershipID.cpp
index 0c69063..c207389 100644
--- a/cppcache/src/ClientProxyMembershipID.cpp
+++ b/cppcache/src/ClientProxyMembershipID.cpp
@@ -29,6 +29,7 @@
#include "DataOutputInternal.hpp"
#include "DistributedSystem.hpp"
#include "Version.hpp"
+#include "util/Log.hpp"
#define DCPORT 12334
#define VMKIND 13
diff --git a/cppcache/src/DataOutputInternal.hpp
b/cppcache/src/DataOutputInternal.hpp
index 35794a3..0ea0341 100644
--- a/cppcache/src/DataOutputInternal.hpp
+++ b/cppcache/src/DataOutputInternal.hpp
@@ -23,8 +23,6 @@
#include <geode/DataOutput.hpp>
#include <geode/PoolManager.hpp> // TODO remove
-#include "CacheImpl.hpp" // TODO remove
-
namespace apache {
namespace geode {
namespace client {
diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp
index c4b89e2..ce73add 100644
--- a/cppcache/src/LocalRegion.cpp
+++ b/cppcache/src/LocalRegion.cpp
@@ -20,6 +20,8 @@
#include <regex>
#include <vector>
+#include <boost/thread/lock_types.hpp>
+
#include <geode/PoolManager.hpp>
#include <geode/SystemProperties.hpp>
#include <geode/internal/DataSerializablePrimitive.hpp>
@@ -109,7 +111,7 @@ const std::string& LocalRegion::getName() const { return
m_name; }
const std::string& LocalRegion::getFullPath() const { return m_fullPath; }
std::shared_ptr<Region> LocalRegion::getParentRegion() const {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getParentRegion);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::getParentRegion);
return m_parentRegion;
}
@@ -137,7 +139,7 @@ void LocalRegion::updateAccessAndModifiedTime(bool
modified) {
}
std::shared_ptr<CacheStatistics> LocalRegion::getStatistics() const {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getStatistics);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::getStatistics);
if (!m_cacheImpl->getDistributedSystem()
.getSystemProperties()
@@ -218,7 +220,7 @@ std::shared_ptr<Region> LocalRegion::findSubRegion(const
std::string& name) {
}
std::shared_ptr<Region> LocalRegion::getSubregion(const std::string& path) {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getSubregion);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::getSubregion);
static const std::string slash("/");
if (path == slash || path.empty()) {
@@ -251,7 +253,7 @@ std::shared_ptr<Region> LocalRegion::getSubregion(const
std::string& path) {
std::shared_ptr<Region> LocalRegion::createSubregion(
const std::string& subregionName, RegionAttributes regionAttributes) {
- CHECK_DESTROY_PENDING(TryWriteGuard, LocalRegion::createSubregion);
+ CHECK_DESTROY_PENDING(unique_lock, LocalRegion::createSubregion);
{
std::string namestr = subregionName;
if (namestr.find('/') != std::string::npos) {
@@ -282,6 +284,7 @@ std::shared_ptr<Region> LocalRegion::createSubregion(
auto pmPtr = regionAttributes.getPersistenceManager();
if (pmPtr == nullptr) {
throw NullPointerException(
+
"PersistenceManager could not be instantiated");
}
auto props = regionAttributes.getPersistenceProperties();
@@ -300,7 +303,7 @@ std::shared_ptr<Region> LocalRegion::createSubregion(
std::vector<std::shared_ptr<Region>> LocalRegion::subregions(
const bool recursive) {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::subregions);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::subregions);
if (m_subRegions.empty()) {
return std::vector<std::shared_ptr<Region>>();
}
@@ -329,7 +332,7 @@ void LocalRegion::getEntry(const
std::shared_ptr<CacheableKey>& key,
}
std::shared_ptr<MapEntryImpl> mePtr;
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getEntry);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::getEntry);
if (m_regionAttributes.getCachingEnabled()) {
m_entries->getEntry(key, mePtr, valuePtr);
}
@@ -542,7 +545,7 @@ bool LocalRegion::localRemoveEx(
}
std::vector<std::shared_ptr<CacheableKey>> LocalRegion::keys() {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::keys);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::keys);
return keys_internal();
}
@@ -552,7 +555,7 @@ std::vector<std::shared_ptr<CacheableKey>>
LocalRegion::serverKeys() {
}
std::vector<std::shared_ptr<Cacheable>> LocalRegion::values() {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::values);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::values);
std::vector<std::shared_ptr<Cacheable>> values;
@@ -565,7 +568,7 @@ std::vector<std::shared_ptr<Cacheable>>
LocalRegion::values() {
}
std::vector<std::shared_ptr<RegionEntry>> LocalRegion::entries(bool recursive)
{
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::entries);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::entries);
std::vector<std::shared_ptr<RegionEntry>> entries;
@@ -606,7 +609,7 @@ HashMapOfCacheable LocalRegion::getAll_internal(
}
uint32_t LocalRegion::size_remote() {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::size);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::size);
if (m_regionAttributes.getCachingEnabled()) {
return m_entries->size();
}
@@ -625,18 +628,18 @@ uint32_t LocalRegion::size() {
return LocalRegion::size_remote();
}
RegionService& LocalRegion::getRegionService() const {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getRegionService);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::getRegionService);
return *m_cacheImpl->getCache();
}
CacheImpl* LocalRegion::getCacheImpl() const {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getCache);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::getCache);
return m_cacheImpl;
}
bool LocalRegion::containsValueForKey_remote(
const std::shared_ptr<CacheableKey>& keyPtr) const {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::containsValueForKey);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::containsValueForKey);
if (!m_regionAttributes.getCachingEnabled()) {
return false;
}
@@ -688,7 +691,7 @@ bool LocalRegion::containsKey(
"LocalRegion::containsKey: "
"key is null");
}
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::containsKey);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::containsKey);
return containsKey_internal(keyPtr);
}
@@ -746,7 +749,7 @@ void LocalRegion::registerEntryExpiryTask(
}
LocalRegion::~LocalRegion() noexcept {
- TryWriteGuard guard(m_rwLock, m_destroyPending);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
if (!m_destroyPending) {
// TODO suspect
// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)
@@ -849,7 +852,7 @@ GfErrType LocalRegion::getNoThrow(
const std::shared_ptr<CacheableKey>& keyPtr,
std::shared_ptr<Cacheable>& value,
const std::shared_ptr<Serializable>& aCallbackArgument) {
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
GfErrType err = GF_NOERR;
if (keyPtr == nullptr) {
@@ -1028,7 +1031,7 @@ GfErrType LocalRegion::getAllNoThrow(
const std::shared_ptr<HashMapOfException>& exceptions,
const bool addToLocalCache,
const std::shared_ptr<Serializable>& aCallbackArgument) {
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
GfErrType err = GF_NOERR;
std::shared_ptr<Cacheable> value;
@@ -1642,7 +1645,7 @@ GfErrType LocalRegion::updateNoThrow(
return err;
}
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
TAction action(*this);
TXState* txState = action.m_txState;
@@ -1788,7 +1791,7 @@ GfErrType LocalRegion::updateNoThrowTX(
return err;
}
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
TAction action(*this);
bool cachingEnabled = m_regionAttributes.getCachingEnabled();
@@ -1928,7 +1931,7 @@ GfErrType LocalRegion::invalidateNoThrowTX(
GfErrType LocalRegion::putAllNoThrow(
const HashMapOfCacheable& map, std::chrono::milliseconds timeout,
const std::shared_ptr<Serializable>& aCallbackArgument) {
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
GfErrType err = GF_NOERR;
// std::shared_ptr<VersionTag> versionTag;
std::shared_ptr<VersionedCacheableObjectPartList>
@@ -2104,7 +2107,7 @@ GfErrType LocalRegion::removeAllNoThrow(
const std::vector<std::shared_ptr<CacheableKey>>& keys,
const std::shared_ptr<Serializable>& aCallbackArgument) {
// 1. check destroy pending
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
GfErrType err = GF_NOERR;
std::shared_ptr<VersionedCacheableObjectPartList> versionedObjPartListPtr;
@@ -2203,8 +2206,12 @@ GfErrType LocalRegion::localClearNoThrow(
/*Update the stats for clear*/
m_regionStats->incClears();
GfErrType err = GF_NOERR;
- TryReadGuard guard(m_rwLock, m_destroyPending);
- if (m_released || m_destroyPending) return err;
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
+
+ if (m_released || m_destroyPending) {
+ return err;
+ }
+
if (!invokeCacheWriterForRegionEvent(aCallbackArgument, eventFlags,
BEFORE_REGION_CLEAR)) {
LOGFINE("Cache writer prevented region clear");
@@ -2225,7 +2232,7 @@ GfErrType LocalRegion::invalidateLocal(
if (keyPtr == nullptr) {
return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
}
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
GfErrType err = GF_NOERR;
@@ -2305,7 +2312,7 @@ GfErrType
LocalRegion::invalidateRegionNoThrowOnSubRegions(
GfErrType LocalRegion::invalidateRegionNoThrow(
const std::shared_ptr<Serializable>& aCallbackArgument,
const CacheEventFlags eventFlags) {
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
GfErrType err = GF_NOERR;
if (m_regionAttributes.getCachingEnabled()) {
@@ -2366,7 +2373,7 @@ GfErrType LocalRegion::destroyRegionNoThrow(
}
}
- TryWriteGuard guard(m_rwLock, m_destroyPending);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
if (m_destroyPending) {
if (eventFlags.isCacheClose()) {
return GF_NOERR;
@@ -2852,7 +2859,7 @@ void LocalRegion::updateAccessAndModifiedTimeForEntry(
}
uint32_t LocalRegion::adjustLruEntriesLimit(uint32_t limit) {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::adjustLruEntriesLimit);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::adjustLruEntriesLimit);
auto attrs = m_regionAttributes;
if (!attrs.getCachingEnabled()) return 0;
@@ -2875,7 +2882,7 @@ uint32_t LocalRegion::adjustLruEntriesLimit(uint32_t
limit) {
ExpirationAction LocalRegion::adjustRegionExpiryAction(
ExpirationAction action) {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::adjustRegionExpiryAction);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::adjustRegionExpiryAction);
auto attrs = m_regionAttributes;
bool hadExpiry = (getRegionExpiryDuration() > std::chrono::seconds::zero());
@@ -2894,7 +2901,7 @@ ExpirationAction LocalRegion::adjustRegionExpiryAction(
}
ExpirationAction LocalRegion::adjustEntryExpiryAction(ExpirationAction action)
{
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::adjustEntryExpiryAction);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::adjustEntryExpiryAction);
auto attrs = m_regionAttributes;
bool hadExpiry = (getEntryExpiryDuration() > std::chrono::seconds::zero());
@@ -2914,7 +2921,7 @@ ExpirationAction
LocalRegion::adjustEntryExpiryAction(ExpirationAction action) {
std::chrono::seconds LocalRegion::adjustRegionExpiryDuration(
const std::chrono::seconds& duration) {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::adjustRegionExpiryDuration);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::adjustRegionExpiryDuration);
bool hadExpiry = (getEntryExpiryDuration() > std::chrono::seconds::zero());
if (!hadExpiry) {
@@ -2933,7 +2940,7 @@ std::chrono::seconds
LocalRegion::adjustRegionExpiryDuration(
std::chrono::seconds LocalRegion::adjustEntryExpiryDuration(
const std::chrono::seconds& duration) {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::adjustEntryExpiryDuration);
+ CHECK_DESTROY_PENDING(shared_lock, LocalRegion::adjustEntryExpiryDuration);
bool hadExpiry = (getEntryExpiryDuration() > std::chrono::seconds::zero());
if (!hadExpiry) {
@@ -3105,49 +3112,53 @@ GfErrType LocalRegion::destroyRegionNoThrow_remote(
void LocalRegion::adjustCacheListener(
const std::shared_ptr<CacheListener>& aListener) {
- WriteGuard guard(m_rwLock);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
setCacheListener(aListener);
m_listener = aListener;
}
void LocalRegion::adjustCacheListener(const std::string& lib,
const std::string& func) {
- WriteGuard guard(m_rwLock);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
setCacheListener(lib, func);
m_listener = m_regionAttributes.getCacheListener();
}
void LocalRegion::adjustCacheLoader(
const std::shared_ptr<CacheLoader>& aLoader) {
- WriteGuard guard(m_rwLock);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
setCacheLoader(aLoader);
m_loader = aLoader;
}
void LocalRegion::adjustCacheLoader(const std::string& lib,
const std::string& func) {
- WriteGuard guard(m_rwLock);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
setCacheLoader(lib, func);
m_loader = m_regionAttributes.getCacheLoader();
}
void LocalRegion::adjustCacheWriter(
const std::shared_ptr<CacheWriter>& aWriter) {
- WriteGuard guard(m_rwLock);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
setCacheWriter(aWriter);
m_writer = aWriter;
}
void LocalRegion::adjustCacheWriter(const std::string& lib,
const std::string& func) {
- WriteGuard guard(m_rwLock);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
setCacheWriter(lib, func);
m_writer = m_regionAttributes.getCacheWriter();
}
void LocalRegion::evict(float percentage) {
- TryReadGuard guard(m_rwLock, m_destroyPending);
- if (m_released || m_destroyPending) return;
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
+
+ if (m_released || m_destroyPending) {
+ return;
+ }
+
if (m_entries != nullptr) {
int32_t size = m_entries->size();
int32_t entriesToEvict = static_cast<int32_t>(percentage * size);
diff --git a/cppcache/src/LocalRegion.hpp b/cppcache/src/LocalRegion.hpp
index 09ac066..46e8891 100644
--- a/cppcache/src/LocalRegion.hpp
+++ b/cppcache/src/LocalRegion.hpp
@@ -51,8 +51,8 @@ namespace geode {
namespace client {
#ifndef CHECK_DESTROY_PENDING
-#define CHECK_DESTROY_PENDING(lock, function) \
- lock checkGuard(m_rwLock, m_destroyPending); \
+#define CHECK_DESTROY_PENDING(lock_type, function) \
+ boost::lock_type<decltype(mutex_)> checkGuard{mutex_}; \
do { \
if (m_destroyPending) { \
std::string err_msg = #function; \
@@ -63,12 +63,12 @@ namespace client {
#endif
#ifndef CHECK_DESTROY_PENDING_NOTHROW
-#define CHECK_DESTROY_PENDING_NOTHROW(lock) \
- lock checkGuard(m_rwLock, m_destroyPending); \
- do { \
- if (m_destroyPending) { \
- return GF_CACHE_REGION_DESTROYED_EXCEPTION; \
- } \
+#define CHECK_DESTROY_PENDING_NOTHROW(lock_type) \
+ boost::lock_type<decltype(mutex_)> checkGuard{mutex_}; \
+ do { \
+ if (m_destroyPending) { \
+ return GF_CACHE_REGION_DESTROYED_EXCEPTION; \
+ } \
} while (0)
#endif
@@ -356,8 +356,8 @@ class APACHE_GEODE_EXPORT LocalRegion : public
RegionInternal {
std::shared_ptr<VersionTag> versionTag);
void setRegionExpiryTask() override;
- void acquireReadLock() override { m_rwLock.acquire_read(); }
- void releaseReadLock() override { m_rwLock.release(); }
+ void acquireReadLock() override { mutex_.lock_shared(); }
+ void releaseReadLock() override { mutex_.unlock_shared(); }
// behaviors for attributes mutator
uint32_t adjustLruEntriesLimit(uint32_t limit) override;
@@ -527,7 +527,7 @@ class APACHE_GEODE_EXPORT LocalRegion : public
RegionInternal {
std::shared_ptr<Pool> m_attachedPool;
bool m_enableTimeStatistics;
- mutable ACE_RW_Thread_Mutex m_rwLock;
+ mutable boost::shared_mutex mutex_;
std::vector<std::shared_ptr<CacheableKey>> keys_internal();
bool containsKey_internal(const std::shared_ptr<CacheableKey>& keyPtr) const;
void removeRegion(const std::string& name);
diff --git a/cppcache/src/MemberListForVersionStamp.cpp
b/cppcache/src/MemberListForVersionStamp.cpp
index 7e8c023..fb6b860 100644
--- a/cppcache/src/MemberListForVersionStamp.cpp
+++ b/cppcache/src/MemberListForVersionStamp.cpp
@@ -16,6 +16,8 @@
*/
#include "MemberListForVersionStamp.hpp"
+#include <boost/thread/lock_types.hpp>
+
#include "util/Log.hpp"
namespace apache {
@@ -33,7 +35,7 @@ MemberListForVersionStamp::~MemberListForVersionStamp() {}
// This function is protected using readers/writer lock
uint16_t MemberListForVersionStamp::add(
std::shared_ptr<DSMemberForVersionStamp> member) {
- WriteGuard guard(m_mapLock);
+ boost::unique_lock<decltype(mutex_)> guard(mutex_);
std::unordered_map<std::string, DistributedMemberWithIntIdentifier>::iterator
it = m_members2.find(member->getHashKey());
if (it != m_members2.end()) return (*it).second.m_identifier;
@@ -50,7 +52,7 @@ uint16_t MemberListForVersionStamp::add(
// This function is protected using readers/writer lock
std::shared_ptr<DSMemberForVersionStamp>
MemberListForVersionStamp::getDSMember(
uint16_t memberId) {
- ReadGuard guard(m_mapLock);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
std::unordered_map<uint32_t,
std::shared_ptr<DSMemberForVersionStamp>>::iterator it =
m_members1.find(memberId);
diff --git a/cppcache/src/MemberListForVersionStamp.hpp
b/cppcache/src/MemberListForVersionStamp.hpp
index f2ab52e..be9d359 100644
--- a/cppcache/src/MemberListForVersionStamp.hpp
+++ b/cppcache/src/MemberListForVersionStamp.hpp
@@ -23,11 +23,11 @@
#include <memory>
#include <unordered_map>
+#include <boost/thread/shared_mutex.hpp>
+
#include <geode/internal/geode_globals.hpp>
#include "DSMemberForVersionStamp.hpp"
-#include "ReadWriteLock.hpp"
-
namespace apache {
namespace geode {
namespace client {
@@ -56,7 +56,7 @@ class MemberListForVersionStamp {
std::unordered_map<std::string, DistributedMemberWithIntIdentifier>
m_members2;
- ACE_RW_Thread_Mutex m_mapLock;
+ boost::shared_mutex mutex_;
uint32_t m_memberCounter;
};
diff --git a/cppcache/src/PdxType.cpp b/cppcache/src/PdxType.cpp
index aa33dfe..f83eb18 100644
--- a/cppcache/src/PdxType.cpp
+++ b/cppcache/src/PdxType.cpp
@@ -23,6 +23,8 @@
#include "PdxType.hpp"
+#include <boost/thread/lock_types.hpp>
+
#include "PdxFieldType.hpp"
#include "PdxHelper.hpp"
#include "PdxTypeRegistry.hpp"
@@ -371,7 +373,6 @@ int32_t* PdxType::getLocalToRemoteMap() {
return m_localToRemoteFieldMap;
}
- ReadGuard guard(m_lockObj);
if (m_localToRemoteFieldMap != nullptr) {
return m_localToRemoteFieldMap;
}
@@ -385,7 +386,6 @@ int32_t* PdxType::getRemoteToLocalMap() {
return m_remoteToLocalFieldMap;
}
- ReadGuard guard(m_lockObj);
if (m_remoteToLocalFieldMap != nullptr) {
return m_remoteToLocalFieldMap;
}
diff --git a/cppcache/src/PdxType.hpp b/cppcache/src/PdxType.hpp
index bf4e676..bc71aa1 100644
--- a/cppcache/src/PdxType.hpp
+++ b/cppcache/src/PdxType.hpp
@@ -30,7 +30,6 @@
#include <geode/Serializable.hpp>
#include "PdxFieldType.hpp"
-#include "ReadWriteLock.hpp"
namespace apache {
namespace geode {
@@ -42,8 +41,6 @@ class PdxTypeRegistry;
class PdxType : public internal::DataSerializableInternal,
public std::enable_shared_from_this<PdxType> {
- ACE_RW_Thread_Mutex m_lockObj;
-
static const char* m_javaPdxClass;
std::vector<std::shared_ptr<PdxFieldType>>* m_pdxFieldTypes;
diff --git a/cppcache/src/PdxTypeRegistry.cpp b/cppcache/src/PdxTypeRegistry.cpp
index 68d2de0..4a165dd 100644
--- a/cppcache/src/PdxTypeRegistry.cpp
+++ b/cppcache/src/PdxTypeRegistry.cpp
@@ -17,6 +17,8 @@
#include "PdxTypeRegistry.hpp"
+#include <boost/thread/lock_types.hpp>
+
#include <geode/PoolManager.hpp>
#include "CacheImpl.hpp"
@@ -68,7 +70,7 @@ int32_t
PdxTypeRegistry::getPDXIdForType(std::shared_ptr<PdxType> nType,
Pool* pool) {
int32_t typeId = 0;
{
- ReadGuard read(g_readerWriterLock_);
+ boost::shared_lock<decltype(types_mutex_)> guard{types_mutex_};
auto&& iter = pdxTypeToTypeIdMap_.find(nType);
if (iter != pdxTypeToTypeIdMap_.end()) {
typeId = iter->second;
@@ -79,7 +81,7 @@ int32_t
PdxTypeRegistry::getPDXIdForType(std::shared_ptr<PdxType> nType,
}
{
- WriteGuard write(g_readerWriterLock_);
+ boost::unique_lock<decltype(types_mutex_)> guard{types_mutex_};
auto&& iter = pdxTypeToTypeIdMap_.find(nType);
if (iter != pdxTypeToTypeIdMap_.end()) {
typeId = iter->second;
@@ -98,7 +100,7 @@ int32_t
PdxTypeRegistry::getPDXIdForType(std::shared_ptr<PdxType> nType,
void PdxTypeRegistry::clear() {
{
- WriteGuard guard(g_readerWriterLock_);
+ boost::unique_lock<decltype(types_mutex_)> guard{types_mutex_};
typeIdToPdxType_.clear();
remoteTypeIdToMergedPdxType_.clear();
@@ -112,19 +114,20 @@ void PdxTypeRegistry::clear() {
pdxTypeToTypeIdMap_.clear();
}
{
- WriteGuard guard(getPreservedDataLock());
+ boost::unique_lock<decltype(preserved_data_mutex_)> guard{
+ preserved_data_mutex_};
preserved_data_.clear();
}
}
void PdxTypeRegistry::addPdxType(int32_t typeId,
std::shared_ptr<PdxType> pdxType) {
- WriteGuard guard(g_readerWriterLock_);
+ boost::unique_lock<decltype(types_mutex_)> guard{types_mutex_};
typeIdToPdxType_.emplace(typeId, pdxType);
}
std::shared_ptr<PdxType> PdxTypeRegistry::getPdxType(int32_t typeId) const {
- ReadGuard guard(g_readerWriterLock_);
+ boost::shared_lock<decltype(types_mutex_)> guard{types_mutex_};
auto&& iter = typeIdToPdxType_.find(typeId);
if (iter != typeIdToPdxType_.end()) {
return iter->second;
@@ -134,13 +137,13 @@ std::shared_ptr<PdxType>
PdxTypeRegistry::getPdxType(int32_t typeId) const {
void PdxTypeRegistry::addLocalPdxType(const std::string& localType,
std::shared_ptr<PdxType> pdxType) {
- WriteGuard guard(g_readerWriterLock_);
+ boost::unique_lock<decltype(types_mutex_)> guard{types_mutex_};
localTypeToPdxType_.emplace(localType, pdxType);
}
std::shared_ptr<PdxType> PdxTypeRegistry::getLocalPdxType(
const std::string& localType) const {
- ReadGuard guard(g_readerWriterLock_);
+ boost::shared_lock<decltype(types_mutex_)> guard{types_mutex_};
auto&& it = localTypeToPdxType_.find(localType);
if (it != localTypeToPdxType_.end()) {
return it->second;
@@ -150,7 +153,7 @@ std::shared_ptr<PdxType> PdxTypeRegistry::getLocalPdxType(
void PdxTypeRegistry::setMergedType(int32_t remoteTypeId,
std::shared_ptr<PdxType> mergedType) {
- WriteGuard guard(g_readerWriterLock_);
+ boost::unique_lock<decltype(types_mutex_)> guard{types_mutex_};
remoteTypeIdToMergedPdxType_.emplace(remoteTypeId, mergedType);
}
@@ -167,7 +170,8 @@ void PdxTypeRegistry::setPreserveData(
std::shared_ptr<PdxSerializable> obj,
std::shared_ptr<PdxRemotePreservedData> data,
ExpiryTaskManager& expiryTaskManager) {
- WriteGuard guard(getPreservedDataLock());
+ boost::unique_lock<decltype(preserved_data_mutex_)> guard{
+ preserved_data_mutex_};
data->setOwner(obj);
auto&& iter = preserved_data_.find(obj);
@@ -194,9 +198,10 @@ void PdxTypeRegistry::setPreserveData(
"PdxTypeRegistry::setPreserveData Successfully inserted new entry in "
"preservedData");
}
+
std::shared_ptr<PdxRemotePreservedData> PdxTypeRegistry::getPreserveData(
std::shared_ptr<PdxSerializable> pdxobj) const {
- ReadGuard guard(getPreservedDataLock());
+ boost::shared_lock<decltype(types_mutex_)> guard{types_mutex_};
const auto& iter = preserved_data_.find((pdxobj));
if (iter != preserved_data_.end()) {
return iter->second;
@@ -214,7 +219,7 @@ int32_t
PdxTypeRegistry::getEnumValue(std::shared_ptr<EnumInfo> ei) {
return val->value();
}
- WriteGuard guard(g_readerWriterLock_);
+ boost::unique_lock<decltype(types_mutex_)> guard{types_mutex_};
tmp = enumToInt_;
const auto& entry2 = tmp->find(ei);
if (entry2 != tmp->end()) {
@@ -247,7 +252,7 @@ std::shared_ptr<EnumInfo> PdxTypeRegistry::getEnum(int32_t
enumVal) {
}
}
- WriteGuard guard(g_readerWriterLock_);
+ boost::unique_lock<decltype(types_mutex_)> guard{types_mutex_};
tmp = intToEnum_;
{
auto&& entry = tmp->find(enumValPtr);
diff --git a/cppcache/src/PdxTypeRegistry.hpp b/cppcache/src/PdxTypeRegistry.hpp
index f278ce6..01c1d30 100644
--- a/cppcache/src/PdxTypeRegistry.hpp
+++ b/cppcache/src/PdxTypeRegistry.hpp
@@ -23,6 +23,8 @@
#include <map>
#include <unordered_map>
+#include <boost/thread/shared_mutex.hpp>
+
#include <geode/Cache.hpp>
#include <geode/PdxSerializable.hpp>
#include <geode/internal/functional.hpp>
@@ -31,7 +33,6 @@
#include "ExpiryTaskManager.hpp"
#include "PdxRemotePreservedData.hpp"
#include "PdxType.hpp"
-#include "ReadWriteLock.hpp"
namespace apache {
namespace geode {
@@ -68,9 +69,9 @@ class APACHE_GEODE_EXPORT PdxTypeRegistry
// TODO:: preserveData need to be of type WeakHashMap
PreservedHashMap preserved_data_;
- mutable ACE_RW_Thread_Mutex g_readerWriterLock_;
+ mutable boost::shared_mutex types_mutex_;
- mutable ACE_RW_Thread_Mutex g_preservedDataLock_;
+ mutable boost::shared_mutex preserved_data_mutex_;
bool pdxIgnoreUnreadFields_;
@@ -131,8 +132,8 @@ class APACHE_GEODE_EXPORT PdxTypeRegistry
int32_t getPDXIdForType(std::shared_ptr<PdxType> nType, Pool* pool);
- ACE_RW_Thread_Mutex& getPreservedDataLock() const {
- return g_preservedDataLock_;
+ boost::shared_mutex& getPreservedDataMutex() const {
+ return preserved_data_mutex_;
}
protected:
diff --git a/cppcache/src/PreservedDataExpiryTask.cpp
b/cppcache/src/PreservedDataExpiryTask.cpp
index 96d4486..3833874 100644
--- a/cppcache/src/PreservedDataExpiryTask.cpp
+++ b/cppcache/src/PreservedDataExpiryTask.cpp
@@ -22,6 +22,8 @@
*/
#include "PreservedDataExpiryTask.hpp"
+#include <boost/thread/lock_types.hpp>
+
#include "ExpiryTaskManager.hpp"
#include "PdxTypeRegistry.hpp"
@@ -35,7 +37,9 @@ PreservedDataExpiryTask::PreservedDataExpiryTask(
: ExpiryTask(manager), type_registry_(type_registry), object_(object) {}
bool PreservedDataExpiryTask::on_expire() {
- WriteGuard guard(type_registry_->getPreservedDataLock());
+ auto& mutex = type_registry_->getPreservedDataMutex();
+ boost::unique_lock<std::remove_reference<decltype(mutex)>::type>
guard{mutex};
+
auto& map = type_registry_->preserved_data_map();
LOGDEBUG(
diff --git a/cppcache/src/PutAllPartialResult.cpp
b/cppcache/src/PutAllPartialResult.cpp
index 4a2e152..531ea52 100644
--- a/cppcache/src/PutAllPartialResult.cpp
+++ b/cppcache/src/PutAllPartialResult.cpp
@@ -16,6 +16,8 @@
*/
#include "PutAllPartialResult.hpp"
+#include <boost/thread/lock_types.hpp>
+
namespace apache {
namespace geode {
namespace client {
@@ -34,7 +36,7 @@ PutAllPartialResult::PutAllPartialResult(int totalMapSize,
void PutAllPartialResult::consolidate(
std::shared_ptr<PutAllPartialResult> other) {
{
- WriteGuard guard(g_readerWriterLock);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
m_succeededKeys->addAll(other->getSucceededKeysAndVersions());
}
saveFailedKey(other->m_firstFailedKey, other->m_firstCauseOfFailure);
@@ -48,7 +50,7 @@ void PutAllPartialResult::addKeysAndVersions(
void PutAllPartialResult::addKeys(
std::shared_ptr<std::vector<std::shared_ptr<CacheableKey>>> m_keys) {
{
- WriteGuard guard(g_readerWriterLock);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
if (m_succeededKeys->getVersionedTagsize() > 0) {
throw IllegalStateException(
"attempt to store versionless keys when there are already versioned "
diff --git a/cppcache/src/PutAllPartialResult.hpp
b/cppcache/src/PutAllPartialResult.hpp
index 44bef1f..90c31c3 100644
--- a/cppcache/src/PutAllPartialResult.hpp
+++ b/cppcache/src/PutAllPartialResult.hpp
@@ -22,6 +22,8 @@
#include <mutex>
+#include <boost/thread/shared_mutex.hpp>
+
#include <geode/CacheableString.hpp>
#include <geode/Serializable.hpp>
@@ -37,7 +39,7 @@ class PutAllPartialResult final : public Serializable {
std::shared_ptr<CacheableKey> m_firstFailedKey;
std::shared_ptr<Exception> m_firstCauseOfFailure;
int32_t m_totalMapSize;
- ACE_RW_Thread_Mutex g_readerWriterLock;
+ boost::shared_mutex mutex_;
public:
PutAllPartialResult(int totalMapSize, std::recursive_mutex& responseLock);
diff --git a/cppcache/src/ReadWriteLock.cpp b/cppcache/src/ReadWriteLock.cpp
deleted file mode 100644
index 18668ba..0000000
--- a/cppcache/src/ReadWriteLock.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "ReadWriteLock.hpp"
-
-#include <thread>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-TryReadGuard::TryReadGuard(ACE_RW_Thread_Mutex& lock,
- const volatile bool& exitCondition)
- : lock_(lock), isAcquired_(false) {
- do {
- if (lock_.tryacquire_read() != -1) {
- isAcquired_ = true;
- break;
- }
- std::this_thread::yield();
- } while (!exitCondition);
-}
-
-TryWriteGuard::TryWriteGuard(ACE_RW_Thread_Mutex& lock,
- const volatile bool& exitCondition)
- : lock_(lock), isAcquired_(false) {
- do {
- if (lock_.tryacquire_write() != -1) {
- isAcquired_ = true;
- break;
- }
- std::this_thread::yield();
- } while (!exitCondition);
-}
-
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/cppcache/src/ReadWriteLock.hpp b/cppcache/src/ReadWriteLock.hpp
deleted file mode 100644
index a6e8960..0000000
--- a/cppcache/src/ReadWriteLock.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#ifndef GEODE_READWRITELOCK_H_
-#define GEODE_READWRITELOCK_H_
-
-#include <ace/RW_Thread_Mutex.h>
-
-#include <geode/internal/geode_globals.hpp>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-class ReadGuard {
- public:
- explicit ReadGuard(ACE_RW_Thread_Mutex& lock) : lock_(lock) {
- lock_.acquire_read();
- }
-
- ~ReadGuard() { lock_.release(); }
- bool isAcquired() { return true; }
-
- private:
- ACE_RW_Thread_Mutex& lock_;
-};
-
-class WriteGuard {
- public:
- explicit WriteGuard(ACE_RW_Thread_Mutex& lock) : lock_(lock) {
- lock_.acquire_write();
- }
-
- ~WriteGuard() { lock_.release(); }
-
- private:
- ACE_RW_Thread_Mutex& lock_;
-};
-
-class TryReadGuard {
- public:
- TryReadGuard(ACE_RW_Thread_Mutex& lock, const volatile bool& exitCondition);
- ~TryReadGuard() {
- if (isAcquired_) lock_.release();
- }
- bool isAcquired() const { return isAcquired_; }
-
- private:
- ACE_RW_Thread_Mutex& lock_;
- bool isAcquired_;
-};
-
-class TryWriteGuard {
- public:
- TryWriteGuard(ACE_RW_Thread_Mutex& lock, const volatile bool& exitCondition);
- ~TryWriteGuard() {
- if (isAcquired_) lock_.release();
- }
- bool isAcquired() const { return isAcquired_; }
-
- private:
- ACE_RW_Thread_Mutex& lock_;
- bool isAcquired_;
-};
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_READWRITELOCK_H_
diff --git a/cppcache/src/RemoteQuery.cpp b/cppcache/src/RemoteQuery.cpp
index a1e3e20..5db516c 100644
--- a/cppcache/src/RemoteQuery.cpp
+++ b/cppcache/src/RemoteQuery.cpp
@@ -17,6 +17,8 @@
#include "RemoteQuery.hpp"
+#include <boost/thread/lock_types.hpp>
+
#include "ResultSetImpl.hpp"
#include "StructSetImpl.hpp"
#include "TcrConnectionManager.hpp"
@@ -125,11 +127,11 @@ GfErrType RemoteQuery::executeNoThrow(
ThinClientBaseDM* tcdm, std::shared_ptr<CacheableVector> paramList) {
LOGFINEST("%s: executing query: %s", func, m_queryString.c_str());
- TryReadGuard guard(m_queryService->getLock(), m_queryService->invalid());
-
+ boost::shared_lock<boost::shared_mutex> guard{m_queryService->getMutex()};
if (m_queryService->invalid()) {
return GF_CACHE_CLOSED_EXCEPTION;
}
+
LOGDEBUG("%s: creating QUERY TcrMessage for query: %s", func,
m_queryString.c_str());
if (paramList != nullptr) {
diff --git a/cppcache/src/RemoteQueryService.cpp
b/cppcache/src/RemoteQueryService.cpp
index cf03367..851fb1f 100644
--- a/cppcache/src/RemoteQueryService.cpp
+++ b/cppcache/src/RemoteQueryService.cpp
@@ -17,9 +17,10 @@
#include "RemoteQueryService.hpp"
+#include <boost/thread/lock_types.hpp>
+
#include "CacheImpl.hpp"
#include "CqServiceVsdStats.hpp"
-#include "ReadWriteLock.hpp"
#include "RemoteQuery.hpp"
#include "ThinClientCacheDistributionManager.hpp"
#include "ThinClientPoolDM.hpp"
@@ -46,50 +47,42 @@ RemoteQueryService::RemoteQueryService(CacheImpl* cache,
}
void RemoteQueryService::init() {
- TryWriteGuard guard(m_rwLock, m_invalid);
-
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
LOGFINEST("RemoteQueryService::init: initializing TCCDM");
if (dynamic_cast<ThinClientCacheDistributionManager*>(m_tccdm)) {
m_tccdm->init();
}
+
m_invalid = false;
LOGFINEST("RemoteQueryService::init: done initialization");
}
}
std::shared_ptr<Query> RemoteQueryService::newQuery(std::string querystring) {
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
+ if (m_invalid) {
+ throw CacheClosedException(
+ "QueryService::newQuery: Cache has been closed.");
+ }
+
LOGDEBUG("RemoteQueryService::newQuery: multiuserMode = %d ",
m_tccdm->isMultiUserMode());
- if (!m_tccdm->isMultiUserMode()) {
- TryReadGuard guard(m_rwLock, m_invalid);
-
- if (m_invalid) {
- throw CacheClosedException(
- "QueryService::newQuery: Cache has been closed.");
- }
-
- LOGDEBUG("RemoteQueryService: creating a new query: " + querystring);
- return std::shared_ptr<Query>(
- new RemoteQuery(querystring, shared_from_this(), m_tccdm));
- } else {
- TryReadGuard guard(m_rwLock, m_invalid);
-
- if (m_invalid) {
- throw CacheClosedException(
- "QueryService::newQuery: Cache has been closed.");
- }
+ LOGDEBUG("RemoteQueryService: creating a new query: " + querystring);
- LOGDEBUG("RemoteQueryService: creating a new query: " + querystring);
- return std::shared_ptr<Query>(new RemoteQuery(
+ if (m_tccdm->isMultiUserMode()) {
+ return std::make_shared<RemoteQuery>(
querystring, shared_from_this(), m_tccdm,
- UserAttributes::threadLocalUserAttributes->getAuthenticatedView()));
+ UserAttributes::threadLocalUserAttributes->getAuthenticatedView());
+ } else {
+ return std::make_shared<RemoteQuery>(querystring, shared_from_this(),
+ m_tccdm);
}
}
void RemoteQueryService::close() {
LOGFINEST("RemoteQueryService::close: starting close");
- TryWriteGuard guard(m_rwLock, m_invalid);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
if (m_cqService != nullptr) {
LOGFINEST("RemoteQueryService::close: starting CQ service close");
@@ -118,8 +111,7 @@ void RemoteQueryService::close() {
* execute all cqs on the endpoint after failover
*/
GfErrType RemoteQueryService::executeAllCqs(TcrEndpoint* endpoint) {
- TryReadGuard guard(m_rwLock, m_invalid);
-
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
LOGFINE("QueryService::executeAllCqs(endpoint): Not initialized.");
return GF_NOERR;
@@ -137,8 +129,7 @@ GfErrType RemoteQueryService::executeAllCqs(TcrEndpoint*
endpoint) {
}
void RemoteQueryService::executeAllCqs(bool failover) {
- TryReadGuard guard(m_rwLock, m_invalid);
-
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
LOGFINE("QueryService::executeAllCqs: Not initialized.");
return;
@@ -156,11 +147,12 @@ void RemoteQueryService::executeAllCqs(bool failover) {
std::shared_ptr<CqQuery> RemoteQueryService::newCq(
std::string querystr, const std::shared_ptr<CqAttributes>& cqAttr,
bool isDurable) {
- TryReadGuard guard(m_rwLock, m_invalid);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
throw CacheClosedException("QueryService::newCq: Cache has been closed.");
}
+
initCqService();
// use query string as name for now
std::string name("_default");
@@ -171,7 +163,7 @@ std::shared_ptr<CqQuery> RemoteQueryService::newCq(
std::shared_ptr<CqQuery> RemoteQueryService::newCq(
std::string name, std::string querystr,
const std::shared_ptr<CqAttributes>& cqAttr, bool isDurable) {
- TryReadGuard guard(m_rwLock, m_invalid);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
throw CacheClosedException("QueryService::newCq: Cache has been closed.");
@@ -182,7 +174,7 @@ std::shared_ptr<CqQuery> RemoteQueryService::newCq(
}
void RemoteQueryService::closeCqs() {
- TryReadGuard guard(m_rwLock, m_invalid);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
LOGFINE("QueryService::closeCqs: Cache has been closed.");
@@ -196,7 +188,7 @@ void RemoteQueryService::closeCqs() {
}
CqService::query_container_type RemoteQueryService::getCqs() const {
- TryReadGuard guard(m_rwLock, m_invalid);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
throw CacheClosedException("QueryService::getCqs: Cache has been closed.");
@@ -213,7 +205,7 @@ CqService::query_container_type
RemoteQueryService::getCqs() const {
std::shared_ptr<CqQuery> RemoteQueryService::getCq(
const std::string& name) const {
- TryReadGuard guard(m_rwLock, m_invalid);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
throw CacheClosedException("QueryService::getCq: Cache has been closed.");
@@ -228,7 +220,7 @@ std::shared_ptr<CqQuery> RemoteQueryService::getCq(
}
void RemoteQueryService::executeCqs() {
- TryReadGuard guard(m_rwLock, m_invalid);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
throw CacheClosedException(
@@ -242,7 +234,7 @@ void RemoteQueryService::executeCqs() {
}
void RemoteQueryService::stopCqs() {
- TryReadGuard guard(m_rwLock, m_invalid);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
LOGFINE("QueryService::stopCqs: Cache has been closed.");
@@ -257,7 +249,7 @@ void RemoteQueryService::stopCqs() {
std::shared_ptr<CqServiceStatistics>
RemoteQueryService::getCqServiceStatistics() const {
- TryReadGuard guard(m_rwLock, m_invalid);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
throw CacheClosedException(
@@ -274,18 +266,8 @@ RemoteQueryService::getCqServiceStatistics() const {
void RemoteQueryService::receiveNotification(TcrMessage& msg) {
{
- TryReadGuard guard(m_rwLock, m_invalid);
-
- if (m_invalid) {
- // do we need this check?
- return;
- }
- /*if cq has not been started, then no cq exists */
- if (!m_cqService) {
- return;
- }
-
- if (!m_cqService->checkAndAcquireLock()) {
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
+ if (m_invalid || !m_cqService || !m_cqService->checkAndAcquireLock()) {
return;
}
}
@@ -295,7 +277,7 @@ void RemoteQueryService::receiveNotification(TcrMessage&
msg) {
std::shared_ptr<CacheableArrayList>
RemoteQueryService::getAllDurableCqsFromServer() const {
- TryReadGuard guard(m_rwLock, m_invalid);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_invalid) {
throw CacheClosedException(
@@ -332,6 +314,8 @@ void
RemoteQueryService::invokeCqConnectedListeners(ThinClientPoolDM* pool,
m_cqService->invokeCqConnectedListeners(poolName, connected);
}
+boost::shared_mutex& RemoteQueryService::getMutex() { return mutex_; }
+
} // namespace client
} // namespace geode
} // namespace apache
diff --git a/cppcache/src/RemoteQueryService.hpp
b/cppcache/src/RemoteQueryService.hpp
index 74e1bb3..8d27109 100644
--- a/cppcache/src/RemoteQueryService.hpp
+++ b/cppcache/src/RemoteQueryService.hpp
@@ -23,7 +23,7 @@
#include <memory>
#include <string>
-#include <ace/RW_Thread_Mutex.h>
+#include <boost/thread/shared_mutex.hpp>
#include <geode/QueryService.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -47,7 +47,7 @@ class RemoteQueryService
void init();
- inline ACE_RW_Thread_Mutex& getLock() { return m_rwLock; }
+ boost::shared_mutex& getMutex();
inline const volatile bool& invalid() { return m_invalid; }
@@ -100,7 +100,7 @@ class RemoteQueryService
private:
volatile bool m_invalid;
- mutable ACE_RW_Thread_Mutex m_rwLock;
+ mutable boost::shared_mutex mutex_;
ThinClientBaseDM* m_tccdm;
std::shared_ptr<CqService> m_cqService;
diff --git a/cppcache/src/TcrMessage.cpp b/cppcache/src/TcrMessage.cpp
index 5e18c08..c9632d7 100644
--- a/cppcache/src/TcrMessage.cpp
+++ b/cppcache/src/TcrMessage.cpp
@@ -23,6 +23,7 @@
#include "AutoDelete.hpp"
#include "BucketServerLocation.hpp"
+#include "CacheImpl.hpp"
#include "CacheRegionHelper.hpp"
#include "DataInputInternal.hpp"
#include "DataOutputInternal.hpp"
@@ -494,7 +495,8 @@ void TcrMessage::readSecureObjectPart(DataInput& input,
bool defaultString,
bool isChunk,
uint8_t isLastChunkWithSecurity) {
LOGDEBUG(
- "TcrMessage::readSecureObjectPart isChunk = %d isLastChunkWithSecurity =
"
+ "TcrMessage::readSecureObjectPart isChunk = %d isLastChunkWithSecurity "
+ "= "
"%d",
isChunk, isLastChunkWithSecurity);
if (isChunk) {
@@ -718,7 +720,8 @@ void TcrMessage::writeObjectPart(
} else {
// TODO::
// CacheableBytes* rawByteArray = static_cast<CacheableBytes*>(se.get());
- // m_request->writeBytesOnly(rawByteArray->value(),
rawByteArray->length());
+ // m_request->writeBytesOnly(rawByteArray->value(),
+ // rawByteArray->length());
writeBytesOnly(se);
}
auto sizeAfterWritingObj = m_request->getBufferLength();
@@ -850,9 +853,9 @@ void TcrMessage::writeMessageLength() {
totalLen -
4); // msg len is written after the msg type which is of 4 bytes ...
m_request->writeInt(static_cast<int32_t>(msgLen));
- m_request->advanceCursor(totalLen - 8); // after writing 4 bytes for msg len
- // you are already 8 bytes ahead
from
- // the beginning.
+ m_request->advanceCursor(totalLen - 8); // after writing 4 bytes for msg
+ // len you are already 8 bytes
+ // ahead from the beginning.
}
void TcrMessage::startProcessChunk(binary_semaphore& finalizeSema) {
@@ -894,7 +897,8 @@ void TcrMessage::startProcessChunk(binary_semaphore&
finalizeSema) {
"response",
m_msgTypeRequest);
throw IllegalStateException(
- "Got unexpected request msg type while starting to process
response");
+ "Got unexpected request msg type while starting to process "
+ "response");
}
}
m_chunkedResult->setFinalizeSemaphore(&finalizeSema);
@@ -918,7 +922,8 @@ void TcrMessage::processChunk(const std::vector<uint8_t>&
chunk, int32_t len,
const uint8_t isLastChunkAndisSecurityHeader) {
// TODO: see if security header is there
LOGDEBUG(
- "TcrMessage::processChunk isLastChunkAndisSecurityHeader = %d chunklen =
"
+ "TcrMessage::processChunk isLastChunkAndisSecurityHeader = %d chunklen "
+ "= "
"%d m_msgType = %d",
isLastChunkAndisSecurityHeader, len, m_msgType);
@@ -1096,7 +1101,8 @@ void TcrMessage::processChunk(const std::vector<uint8_t>&
chunk, int32_t len,
// TODO: how many parts what should we do here
if (chunk.empty()) {
LOGWARN(
- "Got unhandled message type %d while processing response, possible
"
+ "Got unhandled message type %d while processing response, "
+ "possible "
"serialization mismatch",
m_msgType);
throw MessageException(
@@ -1145,7 +1151,8 @@ void TcrMessage::handleByteArrayResponse(
m_txId = input.readInt32();
auto earlyack = input.read();
LOGDEBUG(
- "handleByteArrayResponse m_msgType = %d m_isSecurityOn = %d requesttype "
+ "handleByteArrayResponse m_msgType = %d m_isSecurityOn = %d "
+ "requesttype "
"=%d",
m_msgType, m_isSecurityOn, m_msgTypeRequest);
LOGDEBUG(
diff --git a/cppcache/src/ThinClientHARegion.cpp
b/cppcache/src/ThinClientHARegion.cpp
index 9c66b19..e225163 100644
--- a/cppcache/src/ThinClientHARegion.cpp
+++ b/cppcache/src/ThinClientHARegion.cpp
@@ -17,13 +17,15 @@
#include "ThinClientHARegion.hpp"
+#include <boost/thread/lock_types.hpp>
+
#include <geode/PoolManager.hpp>
#include <geode/SystemProperties.hpp>
#include "CacheImpl.hpp"
-#include "ReadWriteLock.hpp"
#include "TcrHADistributionManager.hpp"
#include "ThinClientPoolHADM.hpp"
+
namespace apache {
namespace geode {
namespace client {
@@ -80,7 +82,7 @@ void ThinClientHARegion::releaseGlobals(bool isFailover) {
}
void ThinClientHARegion::handleMarker() {
- TryReadGuard guard(m_rwLock, m_destroyPending);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_destroyPending) {
return;
}
diff --git a/cppcache/src/ThinClientRegion.cpp
b/cppcache/src/ThinClientRegion.cpp
index 23230f4..171e5dc 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -20,6 +20,8 @@
#include <algorithm>
#include <regex>
+#include <boost/thread/lock_types.hpp>
+
#include <geode/PoolManager.hpp>
#include <geode/Struct.hpp>
#include <geode/SystemProperties.hpp>
@@ -30,7 +32,6 @@
#include "CacheRegionHelper.hpp"
#include "DataInputInternal.hpp"
#include "PutAllPartialResultServerException.hpp"
-#include "ReadWriteLock.hpp"
#include "RegionGlobalLocks.hpp"
#include "RemoteQuery.hpp"
#include "TcrConnectionManager.hpp"
@@ -580,7 +581,7 @@ std::shared_ptr<SelectResults> ThinClientRegion::query(
const std::string& predicate, std::chrono::milliseconds timeout) {
util::PROTOCOL_OPERATION_TIMEOUT_BOUNDS(timeout);
- CHECK_DESTROY_PENDING(TryReadGuard, Region::query);
+ CHECK_DESTROY_PENDING(shared_lock, Region::query);
if (predicate.empty()) {
LOGERROR("Region query predicate string is empty");
@@ -689,7 +690,7 @@ std::shared_ptr<Serializable> ThinClientRegion::selectValue(
}
std::vector<std::shared_ptr<CacheableKey>> ThinClientRegion::serverKeys() {
- CHECK_DESTROY_PENDING(TryReadGuard, Region::serverKeys);
+ CHECK_DESTROY_PENDING(shared_lock, Region::serverKeys);
TcrMessageReply reply(true, m_tcrdm.get());
TcrMessageKeySet request(new DataOutput(m_cacheImpl->createDataOutput()),
@@ -2206,7 +2207,7 @@ GfErrType ThinClientRegion::registerKeysNoThrow(
TcrMessageReply* reply) {
RegionGlobalLocks acquireLocksRedundancy(this, false);
RegionGlobalLocks acquireLocksFailover(this);
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
GfErrType err = GF_NOERR;
std::lock_guard<decltype(m_keysLock)> keysGuard(m_keysLock);
@@ -2278,7 +2279,7 @@ GfErrType ThinClientRegion::unregisterKeysNoThrow(
bool attemptFailover) {
RegionGlobalLocks acquireLocksRedundancy(this, false);
RegionGlobalLocks acquireLocksFailover(this);
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
GfErrType err = GF_NOERR;
std::lock_guard<decltype(m_keysLock)> keysGuard(m_keysLock);
TcrMessageReply reply(true, m_tcrdm.get());
@@ -2364,7 +2365,7 @@ GfErrType ThinClientRegion::registerRegexNoThrow(
TcrMessageReply* reply) {
RegionGlobalLocks acquireLocksRedundancy(this, false);
RegionGlobalLocks acquireLocksFailover(this);
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
GfErrType err = GF_NOERR;
bool allKeys = (regex == ".*");
@@ -2477,7 +2478,7 @@ GfErrType ThinClientRegion::unregisterRegexNoThrow(const
std::string& regex,
bool attemptFailover) {
RegionGlobalLocks acquireLocksRedundancy(this, false);
RegionGlobalLocks acquireLocksFailover(this);
- CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
+ CHECK_DESTROY_PENDING_NOTHROW(shared_lock);
GfErrType err = GF_NOERR;
err = findRegex(regex);
@@ -2593,7 +2594,7 @@ std::vector<std::shared_ptr<CacheableKey>>
ThinClientRegion::getInterestList()
auto nthis = const_cast<ThinClientRegion*>(this);
RegionGlobalLocks acquireLocksRedundancy(nthis, false);
RegionGlobalLocks acquireLocksFailover(nthis);
- CHECK_DESTROY_PENDING(TryReadGuard, getInterestList);
+ CHECK_DESTROY_PENDING(shared_lock, getInterestList);
std::lock_guard<decltype(m_keysLock)> keysGuard(nthis->m_keysLock);
std::vector<std::shared_ptr<CacheableKey>> vlist;
@@ -2616,7 +2617,7 @@ ThinClientRegion::getInterestListRegex() const {
auto nthis = const_cast<ThinClientRegion*>(this);
RegionGlobalLocks acquireLocksRedundancy(nthis, false);
RegionGlobalLocks acquireLocksFailover(nthis);
- CHECK_DESTROY_PENDING(TryReadGuard, getInterestListRegex);
+ CHECK_DESTROY_PENDING(shared_lock, getInterestListRegex);
std::lock_guard<decltype(m_keysLock)> keysGuard(nthis->m_keysLock);
std::vector<std::shared_ptr<CacheableString>> vlist;
@@ -2776,7 +2777,7 @@ GfErrType ThinClientRegion::handleServerException(
void ThinClientRegion::receiveNotification(const TcrMessage& msg) {
std::unique_lock<std::mutex> lock(m_notificationMutex, std::defer_lock);
{
- TryReadGuard guard(m_rwLock, m_destroyPending);
+ boost::shared_lock<decltype(mutex_)> guard{mutex_};
if (m_destroyPending) {
return;
}
@@ -2819,8 +2820,7 @@ void ThinClientRegion::invalidateInterestList(
}
void ThinClientRegion::localInvalidateFailover() {
- CHECK_DESTROY_PENDING(TryReadGuard,
- ThinClientRegion::localInvalidateFailover);
+ CHECK_DESTROY_PENDING(shared_lock,
ThinClientRegion::localInvalidateFailover);
// No need to invalidate from the "m_xxxForUpdatesAsInvalidates" lists?
if (m_interestListRegex.empty() && m_durableInterestListRegex.empty()) {
@@ -2833,7 +2833,7 @@ void ThinClientRegion::localInvalidateFailover() {
void ThinClientRegion::localInvalidateForRegisterInterest(
const std::vector<std::shared_ptr<CacheableKey>>& keys) {
- CHECK_DESTROY_PENDING(TryReadGuard,
+ CHECK_DESTROY_PENDING(shared_lock,
ThinClientRegion::localInvalidateForRegisterInterest);
if (!m_regionAttributes.getCachingEnabled()) {
@@ -2899,7 +2899,7 @@ void ThinClientRegion::release(bool invokeCallbacks) {
}
ThinClientRegion::~ThinClientRegion() noexcept {
- TryWriteGuard guard(m_rwLock, m_destroyPending);
+ boost::unique_lock<decltype(mutex_)> guard{mutex_};
if (!m_destroyPending) {
// TODO suspect
// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)
@@ -3292,6 +3292,9 @@ void ThinClientRegion::txPut(
}
void ThinClientRegion::setProcessedMarker(bool) {}
+boost::shared_mutex& ThinClientRegion::getMetadataMutex() {
+ return region_mutex_;
+}
void ChunkedInterestResponse::reset() {
if (m_resultKeys != nullptr && m_resultKeys->size() > 0) {
diff --git a/cppcache/src/ThinClientRegion.hpp
b/cppcache/src/ThinClientRegion.hpp
index d593ed4..03f6c8a 100644
--- a/cppcache/src/ThinClientRegion.hpp
+++ b/cppcache/src/ThinClientRegion.hpp
@@ -170,7 +170,7 @@ class ThinClientRegion : public LocalRegion {
GfErrType getFuncAttributes(const std::string& func,
std::shared_ptr<std::vector<int8_t>>* attr);
- ACE_RW_Thread_Mutex& getMataDataMutex() { return m_RegionMutex; }
+ boost::shared_mutex& getMetadataMutex();
bool const& getMetaDataRefreshed() { return m_isMetaDataRefreshed; }
@@ -277,7 +277,7 @@ class ThinClientRegion : public LocalRegion {
bool isDurableClient() { return m_isDurableClnt; }
std::shared_ptr<ThinClientBaseDM> m_tcrdm;
std::recursive_mutex m_keysLock;
- mutable ACE_RW_Thread_Mutex m_rwDestroyLock;
+ mutable boost::shared_mutex destroy_mutex_;
std::unordered_map<std::shared_ptr<CacheableKey>, InterestResultPolicy>
m_interestList;
std::unordered_map<std::string, InterestResultPolicy> m_interestListRegex;
@@ -348,7 +348,7 @@ class ThinClientRegion : public LocalRegion {
std::shared_ptr<VersionedCacheableObjectPartList>& versionedObjPartList,
const std::shared_ptr<Serializable>& aCallbackArgument = nullptr);
- ACE_RW_Thread_Mutex m_RegionMutex;
+ boost::shared_mutex region_mutex_;
bool m_isMetaDataRefreshed;
typedef std::unordered_map<
diff --git a/cppcache/src/statistics/HostStatSampler.cpp
b/cppcache/src/statistics/HostStatSampler.cpp
index b77b76f..34510ea 100644
--- a/cppcache/src/statistics/HostStatSampler.cpp
+++ b/cppcache/src/statistics/HostStatSampler.cpp
@@ -28,6 +28,7 @@
#include <boost/filesystem.hpp>
#include <boost/process/environment.hpp>
#include <boost/range/adaptors.hpp>
+#include <boost/thread/lock_types.hpp>
#include <geode/CacheFactory.hpp>
#include <geode/ExceptionTypes.hpp>
@@ -275,7 +276,8 @@ void HostStatSampler::putStatsInAdminRegion() {
if (conn_man->isNetDown()) {
return;
}
- client::TryReadGuard _guard(adminRgn->getRWLock(),
adminRgn->isDestroyed());
+
+ boost::shared_lock<boost::shared_mutex> guard{adminRgn->getMutex()};
if (!adminRgn->isDestroyed()) {
if (conn_man->getNumEndPoints() > 0) {
if (!initDone) {
diff --git a/cppcache/src/statistics/PoolStatsSampler.cpp
b/cppcache/src/statistics/PoolStatsSampler.cpp
index 9e28db0..76bdb01 100644
--- a/cppcache/src/statistics/PoolStatsSampler.cpp
+++ b/cppcache/src/statistics/PoolStatsSampler.cpp
@@ -22,7 +22,6 @@
#include "../AdminRegion.hpp"
#include "../CacheImpl.hpp"
#include "../ClientHealthStats.hpp"
-#include "../ReadWriteLock.hpp"
#include "../ThinClientPoolDM.hpp"
#include "GeodeStatisticsFactory.hpp"
diff --git a/tests/cpp/fwklib/FwkException.hpp
b/tests/cpp/fwklib/FwkException.hpp
index 36f6571..09092de 100644
--- a/tests/cpp/fwklib/FwkException.hpp
+++ b/tests/cpp/fwklib/FwkException.hpp
@@ -36,10 +36,10 @@
#define FWKEXCEPTION(x) \
do { \
- std::ostringstream os; \
- os << x << " In file: " << __FILE__ << " at line: " << __LINE__; \
+ std::stringstream ss; \
+ ss << x << " In file: " << __FILE__ << " at line: " << __LINE__; \
throw apache::geode::client::testframework::FwkException( \
- os.str().c_str()); \
+ ss.str()); \
} while (0)
namespace apache {
diff --git a/tests/cpp/testobject/ArrayOfByte.cpp
b/tests/cpp/testobject/ArrayOfByte.cpp
new file mode 100644
index 0000000..ceb8411
--- /dev/null
+++ b/tests/cpp/testobject/ArrayOfByte.cpp
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ArrayOfByte.hpp"
+
+#include <fwklib/FwkException.hpp>
+#include <fwklib/GsRandom.hpp>
+#include <sstream>
+
+namespace testobject {
+
+using apache::geode::client::DataInputInternal;
+using apache::geode::client::DataOutputInternal;
+using apache::geode::client::Exception;
+using apache::geode::client::testframework::FwkException;
+using apache::geode::client::testframework::GsRandom;
+
+std::shared_ptr<CacheableBytes> ArrayOfByte::init(int size, bool encodeKey,
+ bool encodeTimestamp) {
+ if (encodeKey) {
+ DataOutputInternal dos;
+ try {
+ int32_t index = 1234;
+ dos.writeInt(index);
+ if (encodeTimestamp) {
+ dos.writeInt(
+ std::chrono::system_clock::now().time_since_epoch().count());
+ }
+ } catch (Exception &e) {
+ FWKEXCEPTION("Unable to write to stream " << e.what());
+ }
+ int32_t bufSize = size;
+ char *buf = new char[bufSize];
+ memset(buf, 'V', bufSize);
+ int32_t rsiz = (bufSize <= 20) ? bufSize : 20;
+ GsRandom::getAlphanumericString(rsiz, buf);
+ memcpy(buf, dos.getBuffer(), dos.getBufferLength());
+ return CacheableBytes::create(std::vector<int8_t>(buf, buf + bufSize));
+ } else if (encodeTimestamp) {
+ FWKEXCEPTION("Should not happen");
+ } else {
+ return CacheableBytes::create(std::vector<int8_t>(size));
+ }
+}
+
+int64_t ArrayOfByte::getTimestamp(std::shared_ptr<CacheableBytes> bytes) {
+ if (bytes == nullptr) {
+ throw apache::geode::client::IllegalArgumentException(
+ "the bytes arg was null");
+ }
+ DataInputInternal di(reinterpret_cast<const uint8_t
*>(bytes->value().data()),
+ bytes->length(), nullptr);
+ try {
+ di.readInt32();
+ int64_t timestamp = di.readInt64();
+ if (timestamp == 0) {
+ FWKEXCEPTION("Object is not configured to encode timestamp");
+ }
+ return timestamp;
+ } catch (Exception &e) {
+ FWKEXCEPTION("Unable to read from stream " << e.what());
+ }
+}
+
+void ArrayOfByte::resetTimestamp(std::shared_ptr<CacheableBytes> bytes) {
+ DataInputInternal di(reinterpret_cast<const uint8_t
*>(bytes->value().data()),
+ bytes->length(), nullptr);
+ int32_t index;
+ try {
+ index = di.readInt32();
+ int64_t timestamp = di.readInt64();
+ if (timestamp == 0) {
+ return;
+ }
+ } catch (Exception &e) {
+ FWKEXCEPTION("Unable to read from stream " << e.what());
+ }
+ DataOutputInternal dos;
+ try {
+ dos.writeInt(index);
+ dos.writeInt(std::chrono::system_clock::now().time_since_epoch().count());
+ } catch (Exception &e) {
+ FWKEXCEPTION("Unable to write to stream " << e.what());
+ }
+}
+
+} // namespace testobject
diff --git a/tests/cpp/testobject/ArrayOfByte.hpp
b/tests/cpp/testobject/ArrayOfByte.hpp
index b66db20..9d749b3 100644
--- a/tests/cpp/testobject/ArrayOfByte.hpp
+++ b/tests/cpp/testobject/ArrayOfByte.hpp
@@ -20,105 +20,24 @@
* limitations under the License.
*/
-#include <fwklib/FwkException.hpp>
#include <string>
-#include <ace/Time_Value.h>
-
#include "DataInputInternal.hpp"
#include "DataOutputInternal.hpp"
-#include "SerializationRegistry.hpp"
#include "testobject_export.h"
-#define FWKEXCEPTION(x) \
- do { \
- std::ostringstream os; \
- os << x << " In file: " << __FILE__ << " at line: " << __LINE__; \
- throw apache::geode::client::testframework::FwkException( \
- os.str().c_str()); \
- } while (0)
-
namespace testobject {
using apache::geode::client::CacheableBytes;
-using apache::geode::client::DataInputInternal;
-using apache::geode::client::DataOutputInternal;
-using apache::geode::client::Exception;
-using apache::geode::client::testframework::FwkException;
-using apache::geode::client::testframework::GsRandom;
class TESTOBJECT_EXPORT ArrayOfByte {
public:
static std::shared_ptr<CacheableBytes> init(int size, bool encodeKey,
- bool encodeTimestamp) {
- if (encodeKey) {
- DataOutputInternal dos;
- try {
- int32_t index = 1234;
- dos.writeInt(index);
- if (encodeTimestamp) {
- dos.writeInt(
- std::chrono::system_clock::now().time_since_epoch().count());
- }
- } catch (Exception &e) {
- FWKEXCEPTION("Unable to write to stream " << e.what());
- }
- int32_t bufSize = size;
- char *buf = new char[bufSize];
- memset(buf, 'V', bufSize);
- int32_t rsiz = (bufSize <= 20) ? bufSize : 20;
- GsRandom::getAlphanumericString(rsiz, buf);
- memcpy(buf, dos.getBuffer(), dos.getBufferLength());
- return CacheableBytes::create(std::vector<int8_t>(buf, buf + bufSize));
- } else if (encodeTimestamp) {
- FWKEXCEPTION("Should not happen");
- } else {
- return CacheableBytes::create(std::vector<int8_t>(size));
- }
- }
+ bool encodeTimestamp);
- static int64_t getTimestamp(std::shared_ptr<CacheableBytes> bytes) {
- if (bytes == nullptr) {
- throw apache::geode::client::IllegalArgumentException(
- "the bytes arg was null");
- }
- DataInputInternal di(
- reinterpret_cast<const uint8_t *>(bytes->value().data()),
- bytes->length(), nullptr);
- try {
- di.readInt32();
- int64_t timestamp = di.readInt64();
- if (timestamp == 0) {
- FWKEXCEPTION("Object is not configured to encode timestamp");
- }
- return timestamp;
- } catch (Exception &e) {
- FWKEXCEPTION("Unable to read from stream " << e.what());
- }
- }
+ static int64_t getTimestamp(std::shared_ptr<CacheableBytes> bytes);
- static void resetTimestamp(std::shared_ptr<CacheableBytes> bytes) {
- DataInputInternal di(
- reinterpret_cast<const uint8_t *>(bytes->value().data()),
- bytes->length(), nullptr);
- int32_t index;
- try {
- index = di.readInt32();
- int64_t timestamp = di.readInt64();
- if (timestamp == 0) {
- return;
- }
- } catch (Exception &e) {
- FWKEXCEPTION("Unable to read from stream " << e.what());
- }
- DataOutputInternal dos;
- try {
- dos.writeInt(index);
-
dos.writeInt(std::chrono::system_clock::now().time_since_epoch().count());
- } catch (Exception &e) {
- FWKEXCEPTION("Unable to write to stream " << e.what());
- }
- }
+ static void resetTimestamp(std::shared_ptr<CacheableBytes> bytes);
};
} // namespace testobject
diff --git a/tests/cpp/testobject/CMakeLists.txt
b/tests/cpp/testobject/CMakeLists.txt
index 538afa2..ecc5586 100644
--- a/tests/cpp/testobject/CMakeLists.txt
+++ b/tests/cpp/testobject/CMakeLists.txt
@@ -17,6 +17,7 @@ cmake_minimum_required(VERSION 3.10)
project(testobject LANGUAGES CXX)
add_library(testobject SHARED
+ ArrayOfByte.cpp
ArrayOfByte.hpp
BatchObject.cpp
BatchObject.hpp
diff --git a/tests/cpp/testobject/DeltaTestImpl.cpp
b/tests/cpp/testobject/DeltaTestImpl.cpp
index 50e9918..2babb2e 100644
--- a/tests/cpp/testobject/DeltaTestImpl.cpp
+++ b/tests/cpp/testobject/DeltaTestImpl.cpp
@@ -80,11 +80,10 @@ void DeltaTestImpl::toData(DataOutput& output) const {
void DeltaTestImpl::toDelta(DataOutput& output) const {
{
- ACE_Recursive_Thread_Mutex* lock =
- const_cast<ACE_Recursive_Thread_Mutex*>(&m_lock);
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(*lock);
+ std::lock_guard<decltype(mutex_)> guard{mutex_};
toDeltaCounter++;
}
+
output.write(deltaBits);
if ((deltaBits & INT_MASK) == INT_MASK) {
output.writeInt(intVar);
@@ -105,7 +104,7 @@ void DeltaTestImpl::toDelta(DataOutput& output) const {
void DeltaTestImpl::fromDelta(DataInput& input) {
{
- ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_lock);
+ std::lock_guard<decltype(mutex_)> guard{mutex_};
fromDeltaCounter++;
}
diff --git a/tests/cpp/testobject/DeltaTestImpl.hpp
b/tests/cpp/testobject/DeltaTestImpl.hpp
index 209fb37..918a28b 100644
--- a/tests/cpp/testobject/DeltaTestImpl.hpp
+++ b/tests/cpp/testobject/DeltaTestImpl.hpp
@@ -20,10 +20,11 @@
#ifndef GEODE_TESTOBJECT_DELTATESTIMPL_H_
#define GEODE_TESTOBJECT_DELTATESTIMPL_H_
+#include <mutex>
+
#include <ace/ACE.h>
#include <ace/Condition_T.h>
#include <ace/OS.h>
-#include <ace/Recursive_Thread_Mutex.h>
#include <ace/Task.h>
#include <geode/DataSerializable.hpp>
@@ -61,7 +62,7 @@ class TESTOBJECT_EXPORT DeltaTestImpl : public
DataSerializable, public Delta {
uint8_t deltaBits;
mutable int64_t toDeltaCounter;
int64_t fromDeltaCounter;
- ACE_Recursive_Thread_Mutex m_lock;
+ mutable std::recursive_mutex mutex_;
public:
DeltaTestImpl();
diff --git a/tests/cpp/testobject/NonPdxType.hpp
b/tests/cpp/testobject/NonPdxType.hpp
index 40e3472..07ad4dd 100644
--- a/tests/cpp/testobject/NonPdxType.hpp
+++ b/tests/cpp/testobject/NonPdxType.hpp
@@ -32,7 +32,6 @@
#include <geode/CacheableObjectArray.hpp>
#include <geode/PdxWrapper.hpp>
-#include "SerializationRegistry.hpp"
#include "testobject_export.h"
namespace PdxTests {