THRIFT-1459 declare shared_ptr as boost::shared_ptr
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1213090 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/cpp/src/StressTest.cpp b/test/cpp/src/StressTest.cpp
index 339e7d1..a668fdf 100755
--- a/test/cpp/src/StressTest.cpp
+++ b/test/cpp/src/StressTest.cpp
@@ -109,7 +109,7 @@
class ClientThread: public Runnable {
public:
- ClientThread(shared_ptr<TTransport>transport, shared_ptr<ServiceClient> client, Monitor& monitor, size_t& workerCount, size_t loopCount, TType loopType) :
+ ClientThread(boost::shared_ptr<TTransport>transport, boost::shared_ptr<ServiceClient> client, Monitor& monitor, size_t& workerCount, size_t loopCount, TType loopType) :
_transport(transport),
_client(client),
_monitor(monitor),
@@ -200,8 +200,8 @@
}
}
- shared_ptr<TTransport> _transport;
- shared_ptr<ServiceClient> _client;
+ boost::shared_ptr<TTransport> _transport;
+ boost::shared_ptr<ServiceClient> _client;
Monitor& _monitor;
size_t& _workerCount;
size_t _loopCount;
@@ -326,23 +326,23 @@
cerr << usage;
}
- shared_ptr<PlatformThreadFactory> threadFactory = shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory());
+ boost::shared_ptr<PlatformThreadFactory> threadFactory = boost::shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory());
// Dispatcher
- shared_ptr<Server> serviceHandler(new Server());
+ boost::shared_ptr<Server> serviceHandler(new Server());
if (replayRequests) {
- shared_ptr<Server> serviceHandler(new Server());
- shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
+ boost::shared_ptr<Server> serviceHandler(new Server());
+ boost::shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
// Transports
- shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
+ boost::shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
fileTransport->setChunkSize(2 * 1024 * 1024);
fileTransport->setMaxEventSize(1024 * 16);
fileTransport->seekToEnd();
// Protocol Factory
- shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+ boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
TFileProcessor fileProcessor(serviceProcessor,
protocolFactory,
@@ -355,44 +355,44 @@
if (runServer) {
- shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
+ boost::shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
// Transport
- shared_ptr<TServerSocket> serverSocket(new TServerSocket(port));
+ boost::shared_ptr<TServerSocket> serverSocket(new TServerSocket(port));
// Transport Factory
- shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
+ boost::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
// Protocol Factory
- shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+ boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
if (logRequests) {
// initialize the log file
- shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
+ boost::shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
fileTransport->setChunkSize(2 * 1024 * 1024);
fileTransport->setMaxEventSize(1024 * 16);
transportFactory =
- shared_ptr<TTransportFactory>(new TPipedTransportFactory(fileTransport));
+ boost::shared_ptr<TTransportFactory>(new TPipedTransportFactory(fileTransport));
}
- shared_ptr<Thread> serverThread;
+ boost::shared_ptr<Thread> serverThread;
if (serverType == "simple") {
- serverThread = threadFactory->newThread(shared_ptr<TServer>(new TSimpleServer(serviceProcessor, serverSocket, transportFactory, protocolFactory)));
+ serverThread = threadFactory->newThread(boost::shared_ptr<TServer>(new TSimpleServer(serviceProcessor, serverSocket, transportFactory, protocolFactory)));
} else if (serverType == "threaded") {
- serverThread = threadFactory->newThread(shared_ptr<TServer>(new TThreadedServer(serviceProcessor, serverSocket, transportFactory, protocolFactory)));
+ serverThread = threadFactory->newThread(boost::shared_ptr<TServer>(new TThreadedServer(serviceProcessor, serverSocket, transportFactory, protocolFactory)));
} else if (serverType == "thread-pool") {
- shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(workerCount);
+ boost::shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(workerCount);
threadManager->threadFactory(threadFactory);
threadManager->start();
- serverThread = threadFactory->newThread(shared_ptr<TServer>(new TThreadPoolServer(serviceProcessor, serverSocket, transportFactory, protocolFactory, threadManager)));
+ serverThread = threadFactory->newThread(boost::shared_ptr<TServer>(new TThreadPoolServer(serviceProcessor, serverSocket, transportFactory, protocolFactory, threadManager)));
}
cerr << "Starting the server on port " << port << endl;
@@ -412,7 +412,7 @@
size_t threadCount = 0;
- set<shared_ptr<Thread> > clientThreads;
+ set<boost::shared_ptr<Thread> > clientThreads;
if (callName == "echoVoid") { loopType = T_VOID;}
else if (callName == "echoByte") { loopType = T_BYTE;}
@@ -423,15 +423,15 @@
for (size_t ix = 0; ix < clientCount; ix++) {
- shared_ptr<TSocket> socket(new TSocket("127.0.0.1", port));
- shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket, 2048));
- shared_ptr<TProtocol> protocol(new TBinaryProtocol(bufferedSocket));
- shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol));
+ boost::shared_ptr<TSocket> socket(new TSocket("127.0.0.1", port));
+ boost::shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket, 2048));
+ boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(bufferedSocket));
+ boost::shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol));
- clientThreads.insert(threadFactory->newThread(shared_ptr<ClientThread>(new ClientThread(socket, serviceClient, monitor, threadCount, loopCount, loopType))));
+ clientThreads.insert(threadFactory->newThread(boost::shared_ptr<ClientThread>(new ClientThread(socket, serviceClient, monitor, threadCount, loopCount, loopType))));
}
- for (std::set<shared_ptr<Thread> >::const_iterator thread = clientThreads.begin(); thread != clientThreads.end(); thread++) {
+ for (std::set<boost::shared_ptr<Thread> >::const_iterator thread = clientThreads.begin(); thread != clientThreads.end(); thread++) {
(*thread)->start();
}
@@ -461,9 +461,9 @@
int64_t minTime = 9223372036854775807LL;
int64_t maxTime = 0;
- for (set<shared_ptr<Thread> >::iterator ix = clientThreads.begin(); ix != clientThreads.end(); ix++) {
+ for (set<boost::shared_ptr<Thread> >::iterator ix = clientThreads.begin(); ix != clientThreads.end(); ix++) {
- shared_ptr<ClientThread> client = dynamic_pointer_cast<ClientThread>((*ix)->runnable());
+ boost::shared_ptr<ClientThread> client = dynamic_pointer_cast<ClientThread>((*ix)->runnable());
int64_t delta = client->_endTime - client->_startTime;