blob: cf3ed1042cd90cc4926824b0d602609488863418 [file] [log] [blame]
Mark Sleed788b2e2006-09-07 01:26:35 +00001#ifndef _THRIFT_SERVER_TSIMPLESERVER_H_
2#define _THRIFT_SERVER_TSIMPLESERVER_H_ 1
Mark Sleee8540632006-05-30 09:24:40 +00003
4#include "server/TServer.h"
5#include "transport/TServerTransport.h"
6
Marc Slemko6f038a72006-08-03 18:58:09 +00007namespace facebook { namespace thrift { namespace server {
8
Mark Sleee8540632006-05-30 09:24:40 +00009/**
10 * This is the most basic simple server. It is single-threaded and runs a
11 * continuous loop of accepting a single connection, processing requests on
12 * that connection until it closes, and then repeating. It is a good example
13 * of how to extend the TServer interface.
14 *
15 * @author Mark Slee <mcslee@facebook.com>
16 */
17class TSimpleServer : public TServer {
18 public:
Marc Slemko16698852006-08-04 03:16:10 +000019 TSimpleServer(shared_ptr<TProcessor> processor,
Mark Sleed788b2e2006-09-07 01:26:35 +000020 shared_ptr<TServerTransport> serverTransport,
21 shared_ptr<TTransportFactory> transportFactory,
Mark Slee4af6ed72006-10-25 19:02:49 +000022 shared_ptr<TProtocolFactory> protocolFactory) :
23 TServer(processor, serverTransport, transportFactory, protocolFactory) {}
Aditya Agarwal9abb0d62007-01-24 22:53:54 +000024
25 TSimpleServer(shared_ptr<TProcessor> processor,
26 shared_ptr<TServerTransport> serverTransport,
27 shared_ptr<TTransportFactory> inputTransportFactory,
28 shared_ptr<TTransportFactory> outputTransportFactory,
29 shared_ptr<TProtocolFactory> inputProtocolFactory,
30 shared_ptr<TProtocolFactory> outputProtocolFactory):
31 TServer(processor, serverTransport,
32 inputTransportFactory, outputTransportFactory,
33 inputProtocolFactory, outputProtocolFactory) {}
Mark Sleee8540632006-05-30 09:24:40 +000034
35 ~TSimpleServer() {}
36
Mark Slee794993d2006-09-20 01:56:10 +000037 void serve();
Mark Sleee8540632006-05-30 09:24:40 +000038
Mark Sleee8540632006-05-30 09:24:40 +000039};
40
Marc Slemko6f038a72006-08-03 18:58:09 +000041}}} // facebook::thrift::server
42
Mark Sleed788b2e2006-09-07 01:26:35 +000043#endif // #ifndef _THRIFT_SERVER_TSIMPLESERVER_H_