blob: 7eb87d9426cdb602a1e4ef3b0d903c055150a8fa [file] [log] [blame]
Mark Sleed788b2e2006-09-07 01:26:35 +00001#ifndef _THRIFT_SERVER_TTHREADPOOLSERVER_H_
2#define _THRIFT_SERVER_TTHREADPOOLSERVER_H_ 1
Marc Slemko35452342006-08-03 19:01:37 +00003
Marc Slemko16698852006-08-04 03:16:10 +00004#include <concurrency/ThreadManager.h>
5#include <server/TServer.h>
6#include <transport/TServerTransport.h>
7
8#include <boost/shared_ptr.hpp>
Marc Slemko35452342006-08-03 19:01:37 +00009
10namespace facebook { namespace thrift { namespace server {
Marc Slemko16698852006-08-04 03:16:10 +000011
12using namespace facebook::thrift::concurrency;
13using namespace facebook::thrift::transport;
14using namespace boost;
15
16class TThreadPoolServer : public TServer {
Mark Sleeb3cb6292007-02-01 22:55:00 +000017 public:
Marc Slemko16698852006-08-04 03:16:10 +000018 class Task;
19
20 TThreadPoolServer(shared_ptr<TProcessor> processor,
Martin Kraemer50919172007-01-26 01:41:03 +000021 shared_ptr<TServerTransport> serverTransport,
22 shared_ptr<TTransportFactory> transportFactory,
Mark Slee4af6ed72006-10-25 19:02:49 +000023 shared_ptr<TProtocolFactory> protocolFactory,
Martin Kraemer50919172007-01-26 01:41:03 +000024 shared_ptr<ThreadManager> threadManager);
Marc Slemko16698852006-08-04 03:16:10 +000025
Aditya Agarwal9abb0d62007-01-24 22:53:54 +000026 TThreadPoolServer(shared_ptr<TProcessor> processor,
Martin Kraemer50919172007-01-26 01:41:03 +000027 shared_ptr<TServerTransport> serverTransport,
Aditya Agarwal9abb0d62007-01-24 22:53:54 +000028 shared_ptr<TTransportFactory> inputTransportFactory,
29 shared_ptr<TTransportFactory> outputTransportFactory,
30 shared_ptr<TProtocolFactory> inputProtocolFactory,
31 shared_ptr<TProtocolFactory> outputProtocolFactory,
Martin Kraemer50919172007-01-26 01:41:03 +000032 shared_ptr<ThreadManager> threadManager);
Aditya Agarwal9abb0d62007-01-24 22:53:54 +000033
Marc Slemko16698852006-08-04 03:16:10 +000034 virtual ~TThreadPoolServer();
35
Mark Slee794993d2006-09-20 01:56:10 +000036 virtual void serve();
Marc Slemko16698852006-08-04 03:16:10 +000037
Mark Sleeb3cb6292007-02-01 22:55:00 +000038 protected:
Marc Slemko16698852006-08-04 03:16:10 +000039
Marc Slemko16698852006-08-04 03:16:10 +000040 shared_ptr<ThreadManager> threadManager_;
41
42};
43
Marc Slemko35452342006-08-03 19:01:37 +000044}}} // facebook::thrift::server
45
Mark Sleed788b2e2006-09-07 01:26:35 +000046#endif // #ifndef _THRIFT_SERVER_TTHREADPOOLSERVER_H_