diff options
author | James E. King III <jking@apache.org> | 2019-01-27 11:12:43 -0500 |
---|---|---|
committer | James E. King III <jking@apache.org> | 2019-02-02 22:10:41 -0500 |
commit | 4c57be0b609924f6516dd293985fc6d76f738c16 (patch) | |
tree | 3fc0f94d164e648699847125a9eaffadff29796d /test/cpp | |
parent | d77e0977260fa8d82d56836ed07cdca0f23cadcb (diff) | |
download | thrift-4c57be0b609924f6516dd293985fc6d76f738c16.tar.gz |
THRIFT-4384: fix concurrent sync in cpp async client code
Diffstat (limited to 'test/cpp')
-rwxr-xr-x | test/cpp/CMakeLists.txt | 1 | ||||
-rw-r--r-- | test/cpp/src/StressTest.cpp | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/test/cpp/CMakeLists.txt b/test/cpp/CMakeLists.txt index 0c0bd2f57..90af7826c 100755 --- a/test/cpp/CMakeLists.txt +++ b/test/cpp/CMakeLists.txt @@ -75,6 +75,7 @@ target_link_libraries(StressTest crossstressgencpp ${Boost_LIBRARIES} ${LIBEVENT LINK_AGAINST_THRIFT_LIBRARY(StressTest thrift) LINK_AGAINST_THRIFT_LIBRARY(StressTest thriftnb) add_test(NAME StressTest COMMAND StressTest) +add_test(NAME StressTestConcurrent COMMAND StressTest --client-type=concurrent) add_executable(StressTestNonBlocking src/StressTestNonBlocking.cpp) target_link_libraries(StressTestNonBlocking crossstressgencpp ${Boost_LIBRARIES} ${LIBEVENT_LIB}) diff --git a/test/cpp/src/StressTest.cpp b/test/cpp/src/StressTest.cpp index 16831252f..79a708e8f 100644 --- a/test/cpp/src/StressTest.cpp +++ b/test/cpp/src/StressTest.cpp @@ -44,6 +44,7 @@ using namespace std; using namespace apache::thrift; +using namespace apache::thrift::async; using namespace apache::thrift::protocol; using namespace apache::thrift::transport; using namespace apache::thrift::server; @@ -264,8 +265,8 @@ int main(int argc, char** argv) { string clientType = "regular"; string serverType = "thread-pool"; string protocolType = "binary"; - size_t workerCount = 4; - size_t clientCount = 20; + size_t workerCount = 8; + size_t clientCount = 4; size_t loopCount = 50000; TType loopType = T_VOID; string callName = "echoVoid"; @@ -515,8 +516,8 @@ int main(int argc, char** argv) { std::shared_ptr<TSocket> socket(new TSocket("127.0.0.1", port)); std::shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket, 2048)); std::shared_ptr<TProtocol> protocol(new TBinaryProtocol(bufferedSocket)); - //std::shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol)); - std::shared_ptr<ServiceConcurrentClient> serviceClient(new ServiceConcurrentClient(protocol)); + auto sync = std::make_shared<TConcurrentClientSyncInfo>(); + std::shared_ptr<ServiceConcurrentClient> serviceClient(new ServiceConcurrentClient(protocol, sync)); socket->open(); for (size_t ix = 0; ix < clientCount; ix++) { clientThreads.insert(threadFactory->newThread(std::shared_ptr<ClientThread>( |