blob: c6306b2668783482e16056c77dc51570952732de [file] [log] [blame]
Mark Slee9f0c6512007-02-28 23:58:26 +00001// Copyright (c) 2006- Facebook
2// Distributed under the Thrift Software License
3//
4// See accompanying file LICENSE or visit the Thrift site at:
5// http://developers.facebook.com/thrift/
6
Mark Sleeb3cb6292007-02-01 22:55:00 +00007#ifndef _THRIFT_SERVER_TTHREADEDSERVER_H_
8#define _THRIFT_SERVER_TTHREADEDSERVER_H_ 1
9
10#include <server/TServer.h>
11#include <transport/TServerTransport.h>
12#include <concurrency/Thread.h>
13
14#include <boost/shared_ptr.hpp>
15
16namespace facebook { namespace thrift { namespace server {
17
Mark Slee5ea15f92007-03-05 22:55:59 +000018using facebook::thrift::TProcessor;
19using facebook::thrift::transport::TServerTransport;
20using facebook::thrift::transport::TTransportFactory;
21using facebook::thrift::concurrency::ThreadFactory;
Mark Sleeb3cb6292007-02-01 22:55:00 +000022
23class TThreadedServer : public TServer {
24
25 public:
26 class Task;
27
Mark Slee5ea15f92007-03-05 22:55:59 +000028 TThreadedServer(boost::shared_ptr<TProcessor> processor,
29 boost::shared_ptr<TServerTransport> serverTransport,
30 boost::shared_ptr<TTransportFactory> transportFactory,
31 boost::shared_ptr<TProtocolFactory> protocolFactory);
Mark Sleeb3cb6292007-02-01 22:55:00 +000032
33 virtual ~TThreadedServer();
34
35 virtual void serve();
36
37 protected:
Mark Slee5ea15f92007-03-05 22:55:59 +000038 boost::shared_ptr<ThreadFactory> threadFactory_;
Mark Sleeb3cb6292007-02-01 22:55:00 +000039
40};
41
42}}} // facebook::thrift::server
43
44#endif // #ifndef _THRIFT_SERVER_TTHREADEDSERVER_H_