1 // Copyright (c) 2006- Facebook
2 // Distributed under the Thrift Software License
4 // See accompanying file LICENSE or visit the Thrift site at:
5 // http://developers.facebook.com/thrift/
7 #ifndef _THRIFT_SERVER_TSIMPLESERVER_H_
8 #define _THRIFT_SERVER_TSIMPLESERVER_H_ 1
10 #include "server/TServer.h"
11 #include "transport/TServerTransport.h"
13 namespace facebook
{ namespace thrift
{ namespace server
{
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.
21 * @author Mark Slee <mcslee@facebook.com>
23 class TSimpleServer
: public TServer
{
25 TSimpleServer(boost::shared_ptr
<TProcessor
> processor
,
26 boost::shared_ptr
<TServerTransport
> serverTransport
,
27 boost::shared_ptr
<TTransportFactory
> transportFactory
,
28 boost::shared_ptr
<TProtocolFactory
> protocolFactory
) :
29 TServer(processor
, serverTransport
, transportFactory
, protocolFactory
),
32 TSimpleServer(boost::shared_ptr
<TProcessor
> processor
,
33 boost::shared_ptr
<TServerTransport
> serverTransport
,
34 boost::shared_ptr
<TTransportFactory
> inputTransportFactory
,
35 boost::shared_ptr
<TTransportFactory
> outputTransportFactory
,
36 boost::shared_ptr
<TProtocolFactory
> inputProtocolFactory
,
37 boost::shared_ptr
<TProtocolFactory
> outputProtocolFactory
):
38 TServer(processor
, serverTransport
,
39 inputTransportFactory
, outputTransportFactory
,
40 inputProtocolFactory
, outputProtocolFactory
),
56 }}} // facebook::thrift::server
58 #endif // #ifndef _THRIFT_SERVER_TSIMPLESERVER_H_