Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 08:35:02

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one
0003  * or more contributor license agreements. See the NOTICE file
0004  * distributed with this work for additional information
0005  * regarding copyright ownership. The ASF licenses this file
0006  * to you under the Apache License, Version 2.0 (the
0007  * "License"); you may not use this file except in compliance
0008  * with the License. You may obtain a copy of the License at
0009  *
0010  *   http://www.apache.org/licenses/LICENSE-2.0
0011  *
0012  * Unless required by applicable law or agreed to in writing,
0013  * software distributed under the License is distributed on an
0014  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0015  * KIND, either express or implied. See the License for the
0016  * specific language governing permissions and limitations
0017  * under the License.
0018  */
0019 
0020 #ifndef _THRIFT_SERVER_TSIMPLESERVER_H_
0021 #define _THRIFT_SERVER_TSIMPLESERVER_H_ 1
0022 
0023 #include <thrift/server/TServerFramework.h>
0024 
0025 namespace apache {
0026 namespace thrift {
0027 namespace server {
0028 
0029 /**
0030  * This is the most basic simple server. It is single-threaded and runs a
0031  * continuous loop of accepting a single connection, processing requests on
0032  * that connection until it closes, and then repeating.
0033  */
0034 class TSimpleServer : public TServerFramework {
0035 public:
0036   TSimpleServer(
0037       const std::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
0038       const std::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
0039       const std::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
0040       const std::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
0041 
0042   TSimpleServer(
0043       const std::shared_ptr<apache::thrift::TProcessor>& processor,
0044       const std::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
0045       const std::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
0046       const std::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
0047 
0048   TSimpleServer(
0049       const std::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
0050       const std::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
0051       const std::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
0052       const std::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
0053       const std::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
0054       const std::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
0055 
0056   TSimpleServer(
0057       const std::shared_ptr<apache::thrift::TProcessor>& processor,
0058       const std::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
0059       const std::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
0060       const std::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
0061       const std::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
0062       const std::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
0063 
0064   ~TSimpleServer() override;
0065 
0066 protected:
0067   void onClientConnected(const std::shared_ptr<TConnectedClient>& pClient) override /* override */;
0068   void onClientDisconnected(TConnectedClient* pClient) override /* override */;
0069 
0070 private:
0071   void setConcurrentClientLimit(int64_t newLimit) override; // hide
0072 };
0073 }
0074 }
0075 } // apache::thrift::server
0076 
0077 #endif // #ifndef _THRIFT_SERVER_TSIMPLESERVER_H_