2012-02-28 21:11:51 +00:00
|
|
|
/*
|
|
|
|
* blsm_server.cpp
|
|
|
|
*
|
|
|
|
* Copyright 2009-2012 Yahoo! Inc.
|
|
|
|
*
|
|
|
|
* Licensed 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.
|
|
|
|
*
|
|
|
|
*/
|
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;
|
|
|
|
}
|