blob: a8242d4a2ebce7f2a03014324b95c23e7da2500a [file] [log] [blame]
Mark Sleee8540632006-05-30 09:24:40 +00001#ifndef T_SIMPLE_SERVER_H
2#define T_SIMPLE_SERVER_H
3
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,
20 shared_ptr<TServerOptions> options,
21 shared_ptr<TServerTransport> serverTransport) :
Mark Slee8d7e1f62006-06-07 06:48:56 +000022 TServer(processor, options), serverTransport_(serverTransport) {}
Mark Sleee8540632006-05-30 09:24:40 +000023
24 ~TSimpleServer() {}
25
26 void run();
27
28 protected:
Marc Slemko16698852006-08-04 03:16:10 +000029 shared_ptr<TServerTransport> serverTransport_;
Mark Sleee8540632006-05-30 09:24:40 +000030};
31
Marc Slemko6f038a72006-08-03 18:58:09 +000032}}} // facebook::thrift::server
33
Mark Sleee8540632006-05-30 09:24:40 +000034#endif