blob: 05befbf4c5be6ba4439d4b2c902aeb84987b5376 [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 Sleed788b2e2006-09-07 01:26:35 +00007#ifndef _THRIFT_SERVER_TSIMPLESERVER_H_
8#define _THRIFT_SERVER_TSIMPLESERVER_H_ 1
Mark Sleee8540632006-05-30 09:24:40 +00009
10#include "server/TServer.h"
11#include "transport/TServerTransport.h"
12
Marc Slemko6f038a72006-08-03 18:58:09 +000013namespace facebook { namespace thrift { namespace server {
14
Mark Sleee8540632006-05-30 09:24:40 +000015/**
16 * This is the most basic simple server. It is single-threaded and runs a
17 * continuous loop of accepting a single connection, processing requests on
18 * that connection until it closes, and then repeating. It is a good example
19 * of how to extend the TServer interface.
20 *
21 * @author Mark Slee <mcslee@facebook.com>
22 */
23class TSimpleServer : public TServer {
24 public:
Marc Slemko16698852006-08-04 03:16:10 +000025 TSimpleServer(shared_ptr<TProcessor> processor,
Mark Sleed788b2e2006-09-07 01:26:35 +000026 shared_ptr<TServerTransport> serverTransport,
27 shared_ptr<TTransportFactory> transportFactory,
Mark Slee4af6ed72006-10-25 19:02:49 +000028 shared_ptr<TProtocolFactory> protocolFactory) :
29 TServer(processor, serverTransport, transportFactory, protocolFactory) {}
Aditya Agarwal9abb0d62007-01-24 22:53:54 +000030
31 TSimpleServer(shared_ptr<TProcessor> processor,
32 shared_ptr<TServerTransport> serverTransport,
33 shared_ptr<TTransportFactory> inputTransportFactory,
34 shared_ptr<TTransportFactory> outputTransportFactory,
35 shared_ptr<TProtocolFactory> inputProtocolFactory,
36 shared_ptr<TProtocolFactory> outputProtocolFactory):
37 TServer(processor, serverTransport,
38 inputTransportFactory, outputTransportFactory,
39 inputProtocolFactory, outputProtocolFactory) {}
Mark Sleee8540632006-05-30 09:24:40 +000040
41 ~TSimpleServer() {}
42
Mark Slee794993d2006-09-20 01:56:10 +000043 void serve();
Mark Sleee8540632006-05-30 09:24:40 +000044
Mark Sleee8540632006-05-30 09:24:40 +000045};
46
Marc Slemko6f038a72006-08-03 18:58:09 +000047}}} // facebook::thrift::server
48
Mark Sleed788b2e2006-09-07 01:26:35 +000049#endif // #ifndef _THRIFT_SERVER_TSIMPLESERVER_H_