-namespace test.stress
+cpp_namespace test.stress
service Service {
void echoVoid(),
- byte echoByte(byte arg),
- i32 echoI32(i32 arg),
- i64 echoI64(i64 arg),
- string echoString(string arg),
- list<byte> echoList(list<byte> arg),
- set<byte> echoSet(set<byte> arg),
- map<byte, byte> echoMap(map<byte, byte> arg),
+ byte echoByte(1: byte arg),
+ i32 echoI32(1: i32 arg),
+ i64 echoI64(1: i64 arg),
+ string echoString(1: string arg),
+ list<byte> echoList(1: list<byte> arg),
+ set<byte> echoSet(1: set<byte> arg),
+ map<byte, byte> echoMap(1: map<byte, byte> arg),
}
#include <server/TThreadPoolServer.h>
#include <transport/TServerSocket.h>
#include <transport/TSocket.h>
-#include <transport/TBufferedTransport.h>
-#include <transport/TBufferedTransportFactory.h>
+#include <transport/TTransportUtils.h>
#include <transport/TBufferedRouterTransport.h>
-#include <transport/TBufferedRouterTransportFactory.h>
#include <transport/TBufferedFileWriter.h>
#include "Service.h"
if(runServer) {
// Dispatcher
- shared_ptr<TBinaryProtocol> binaryProtocol(new TBinaryProtocol);
-
shared_ptr<Server> serviceHandler(new Server());
- shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler, binaryProtocol));
+ shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
// Transport
shared_ptr<TServerSocket> serverSocket(new TServerSocket(port));
// Transport Factory
shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
- // Options
- shared_ptr<TServerOptions> serverOptions(new TServerOptions());
+ // Protocol Factory
+ shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
if (logRequests) {
// initialize the log file
if(serverType == "simple") {
- serverThread = threadFactory->newThread(shared_ptr<TServer>(new TSimpleServer(serviceProcessor,
- serverSocket,
- transportFactory,
- serverOptions)));
+ serverThread = threadFactory->newThread(shared_ptr<TServer>(new TSimpleServer(serviceProcessor, serverSocket, transportFactory, protocolFactory)));
} else if(serverType == "thread-pool") {
shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(workerCount);
threadManager->threadFactory(threadFactory);
-
- threadManager->start();
-
- serverThread = threadFactory->newThread(shared_ptr<TServer>(new TThreadPoolServer(serviceProcessor,
- serverSocket,
- transportFactory,
- threadManager,
- serverOptions)));
+ threadManager->start();
+ serverThread = threadFactory->newThread(shared_ptr<TServer>(new TThreadPoolServer(serviceProcessor, serverSocket, transportFactory, protocolFactory, threadManager)));
}
cerr << "Starting the server on port " << port << endl;
// If we aren't running clients, just wait forever for external clients
- if(clientCount == 0) {
+ if (clientCount == 0) {
serverThread->join();
}
}
- if(clientCount > 0) {
+ if (clientCount > 0) {
Monitor monitor;
shared_ptr<TSocket> socket(new TSocket("127.0.01", port));
shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket, 2048));
- shared_ptr<TBinaryProtocol> binaryProtocol(new TBinaryProtocol());
- shared_ptr<ServiceClient> serviceClient(new ServiceClient(socket, binaryProtocol));
+ shared_ptr<TProtocol> protocol(new TBinaryProtocol(bufferedSocket, bufferedSocket));
+ shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol));
clientThreads.insert(threadFactory->newThread(shared_ptr<ClientThread>(new ClientThread(socket, serviceClient, monitor, threadCount, loopCount, loopType))));
}