Mark Slee | d788b2e | 2006-09-07 01:26:35 +0000 | [diff] [blame] | 1 | #ifndef _THRIFT_SERVER_TSIMPLESERVER_H_ |
| 2 | #define _THRIFT_SERVER_TSIMPLESERVER_H_ 1 |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 3 | |
| 4 | #include "server/TServer.h" |
| 5 | #include "transport/TServerTransport.h" |
| 6 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 7 | namespace facebook { namespace thrift { namespace server { |
| 8 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 9 | /** |
| 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 | */ |
| 17 | class TSimpleServer : public TServer { |
| 18 | public: |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 19 | TSimpleServer(shared_ptr<TProcessor> processor, |
Mark Slee | d788b2e | 2006-09-07 01:26:35 +0000 | [diff] [blame] | 20 | shared_ptr<TServerTransport> serverTransport, |
| 21 | shared_ptr<TTransportFactory> transportFactory, |
| 22 | shared_ptr<TServerOptions> options) : |
| 23 | TServer(processor, serverTransport, transportFactory, options) {} |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 24 | |
| 25 | ~TSimpleServer() {} |
| 26 | |
Mark Slee | 794993d | 2006-09-20 01:56:10 +0000 | [diff] [blame] | 27 | void serve(); |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 28 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 29 | }; |
| 30 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 31 | }}} // facebook::thrift::server |
| 32 | |
Mark Slee | d788b2e | 2006-09-07 01:26:35 +0000 | [diff] [blame] | 33 | #endif // #ifndef _THRIFT_SERVER_TSIMPLESERVER_H_ |