2011-08-23 00:10:43 +00:00
|
|
|
#include "MapKeeper.h"
|
2011-05-11 22:27:48 +00:00
|
|
|
#include <protocol/TBinaryProtocol.h>
|
|
|
|
#include <server/TSimpleServer.h>
|
|
|
|
#include <server/TThreadPoolServer.h>
|
2011-08-23 00:10:43 +00:00
|
|
|
#include <server/TThreadedServer.h>
|
2011-05-11 22:27:48 +00:00
|
|
|
#include <transport/TServerSocket.h>
|
|
|
|
#include <transport/TBufferTransports.h>
|
2011-08-23 00:10:43 +00:00
|
|
|
#include <concurrency/ThreadManager.h>
|
|
|
|
#include <concurrency/PosixThreadFactory.h>
|
2012-02-23 01:25:24 +00:00
|
|
|
#include "bLSM.h"
|
|
|
|
#include "dataTuple.h"
|
|
|
|
#include "bLSMRequestHandler.h"
|
2011-05-11 22:27:48 +00:00
|
|
|
|
|
|
|
using namespace ::apache::thrift;
|
|
|
|
using namespace ::apache::thrift::protocol;
|
|
|
|
using namespace ::apache::thrift::transport;
|
|
|
|
using namespace ::apache::thrift::server;
|
|
|
|
using namespace ::apache::thrift::concurrency;
|
|
|
|
using boost::shared_ptr;
|
|
|
|
|
2011-08-23 00:10:43 +00:00
|
|
|
using namespace mapkeeper;
|
2011-05-11 22:27:48 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
shared_ptr<LSMServerHandler> handler(new LSMServerHandler(argc, argv));
|
2011-08-23 00:10:43 +00:00
|
|
|
shared_ptr<TProcessor> processor(new MapKeeperProcessor(handler));
|
2012-01-13 00:13:33 +00:00
|
|
|
shared_ptr<TServerTransport> serverTransport(new TServerSocket(handler->port));
|
2011-05-11 22:27:48 +00:00
|
|
|
shared_ptr<TTransportFactory> transportFactory(new TFramedTransportFactory());
|
|
|
|
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
|
|
|
|
shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(32);
|
|
|
|
shared_ptr<ThreadFactory> threadFactory(new PosixThreadFactory());
|
2011-08-23 00:10:43 +00:00
|
|
|
//threadManager->threadFactory(threadFactory);
|
|
|
|
//threadManager->start();
|
|
|
|
TThreadedServer server(processor, serverTransport, transportFactory, protocolFactory);
|
|
|
|
printf("I'm using tthreaded server!");
|
2011-05-11 22:27:48 +00:00
|
|
|
server.serve();
|
|
|
|
return 0;
|
|
|
|
}
|