Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 1 | #ifndef T_SIMPLE_SERVER_H |
| 2 | #define T_SIMPLE_SERVER_H |
| 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, |
| 20 | shared_ptr<TServerOptions> options, |
| 21 | shared_ptr<TServerTransport> serverTransport) : |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 22 | TServer(processor, options), serverTransport_(serverTransport) {} |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 23 | |
| 24 | ~TSimpleServer() {} |
| 25 | |
| 26 | void run(); |
| 27 | |
| 28 | protected: |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 29 | shared_ptr<TServerTransport> serverTransport_; |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 30 | }; |
| 31 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 32 | }}} // facebook::thrift::server |
| 33 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 34 | #endif |