blob: 51b00e4ac6a2e9614c5b8ff6adf930c5f42a74a7 [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
Mark Slee9f0c6512007-02-28 23:58:26 +000019
Mark Sleed788b2e2006-09-07 01:26:35 +000020#ifndef _THRIFT_SERVER_TSIMPLESERVER_H_
21#define _THRIFT_SERVER_TSIMPLESERVER_H_ 1
Mark Sleee8540632006-05-30 09:24:40 +000022
Jim King21b68522015-04-26 18:30:26 -040023#include <thrift/server/TServerFramework.h>
Mark Sleee8540632006-05-30 09:24:40 +000024
Konrad Grochowski16a23a62014-11-13 15:33:38 +010025namespace apache {
26namespace thrift {
27namespace server {
Marc Slemko6f038a72006-08-03 18:58:09 +000028
Mark Sleee8540632006-05-30 09:24:40 +000029/**
30 * This is the most basic simple server. It is single-threaded and runs a
31 * continuous loop of accepting a single connection, processing requests on
Jim King21b68522015-04-26 18:30:26 -040032 * that connection until it closes, and then repeating.
Mark Sleee8540632006-05-30 09:24:40 +000033 */
Jim King21b68522015-04-26 18:30:26 -040034class TSimpleServer : public TServerFramework {
Konrad Grochowski16a23a62014-11-13 15:33:38 +010035public:
Jim King21b68522015-04-26 18:30:26 -040036 TSimpleServer(const boost::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
37 const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
38 const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
39 const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
Bryan Duxbury7a9fb812011-09-01 18:31:53 +000040
Jim King21b68522015-04-26 18:30:26 -040041 TSimpleServer(const boost::shared_ptr<apache::thrift::TProcessor>& processor,
42 const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
43 const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
44 const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
Aditya Agarwal9abb0d62007-01-24 22:53:54 +000045
Jim King21b68522015-04-26 18:30:26 -040046 TSimpleServer(const boost::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
47 const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
48 const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
49 const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
50 const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
51 const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
Bryan Duxbury7a9fb812011-09-01 18:31:53 +000052
Jim King21b68522015-04-26 18:30:26 -040053 TSimpleServer(const boost::shared_ptr<apache::thrift::TProcessor>& processor,
54 const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
55 const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
56 const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
57 const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
58 const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
Mark Sleeb4d3e7b2007-11-28 01:51:43 +000059
Jim King21b68522015-04-26 18:30:26 -040060 virtual ~TSimpleServer();
Mark Slee6e3f6372007-03-01 22:05:46 +000061
Konrad Grochowski16a23a62014-11-13 15:33:38 +010062protected:
Jim King21b68522015-04-26 18:30:26 -040063 virtual void onClientConnected(const boost::shared_ptr<TConnectedClient>& pClient) /* override */;
64 virtual void onClientDisconnected(TConnectedClient *pClient) /* override */;
Mark Sleee8540632006-05-30 09:24:40 +000065};
Jim King21b68522015-04-26 18:30:26 -040066
Konrad Grochowski16a23a62014-11-13 15:33:38 +010067}
68}
69} // apache::thrift::server
Marc Slemko6f038a72006-08-03 18:58:09 +000070
Mark Sleed788b2e2006-09-07 01:26:35 +000071#endif // #ifndef _THRIFT_SERVER_TSIMPLESERVER_H_