Update dependencies

This commit is contained in:
James
2017-08-16 11:15:14 -07:00
parent b9c0374fe3
commit f46ea14760
1220 changed files with 142690 additions and 47576 deletions

60
glide.lock generated
View File

@@ -1,12 +1,12 @@
hash: b555054a6f86ac84f6104ad9efabdcd85966c8f6574e485be7337c3ee9f29aa0
updated: 2017-08-03T03:58:34.544868553-07:00
updated: 2017-08-16T11:13:27.488480563-07:00
imports:
- name: github.com/amir/raidman
version: 1ccc43bfb9c93cb401a4025e49c64ba71e5e668b
subpackages:
- proto
- name: github.com/apache/thrift
version: 0eda909573cc7d8550c285035652e8b883ebc8f7
version: ec64f23d236d7874e3b28ae86c833f57c7aa3389
subpackages:
- lib/go/thrift
- name: github.com/asaskevich/govalidator
@@ -102,7 +102,7 @@ imports:
- name: github.com/docker/go-units
version: 0dadbb0345b35ec7ef35e228dabb8de89a65bf52
- name: github.com/docker/libtrust
version: fa567046d9b14f6aa788882a950d69651d230b21
version: aabc10ec26b754e797f9028f4589c5b7bd90dc20
- name: github.com/eapache/go-resiliency
version: b1fe83b5b03f624450823b751b662259ffc6af70
subpackages:
@@ -114,9 +114,9 @@ imports:
- name: github.com/fsnotify/fsnotify
version: 4da3e2cfbabc9f751898f250b49f2439785783a1
- name: github.com/fsouza/go-dockerclient
version: 443bd55851743b8b85c5c3819777f43aaa8e275e
version: 75772940379e725b5aae213e570f9dcd751951cb
- name: github.com/funcy/functions_go
version: c540b7a8e1af8dad992a3b520175db85f8e53636
version: fc7e7ca2fbc8bef236300b7b9f1075410a62447f
subpackages:
- client
- client/apps
@@ -127,14 +127,14 @@ imports:
- client/version
- models
- name: github.com/garyburd/redigo
version: 9e66b83d15a259978be267d0b61838c42c3904e3
version: b925df3cc15d8646e9b5b333ebaf3011385aba11
subpackages:
- internal
- redis
- name: github.com/gin-contrib/sse
version: 22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae
- name: github.com/gin-gonic/gin
version: 81007d2ce0176f7a9ce52dd12e56edd7ef40e72c
version: a8fa424ae529397d4a0f2a1f9fda8031851a3269
subpackages:
- binding
- json
@@ -142,7 +142,7 @@ imports:
- name: github.com/go-logfmt/logfmt
version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5
- name: github.com/go-openapi/analysis
version: 0473cb67199f68b8b7d90e641afd9e79ad36b851
version: 8ed83f2ea9f00f945516462951a288eaa68bf0d6
- name: github.com/go-openapi/errors
version: 03cfca65330da08a5a440053faf994a3c682b5bf
- name: github.com/go-openapi/jsonpointer
@@ -154,11 +154,11 @@ imports:
subpackages:
- fmts
- name: github.com/go-openapi/runtime
version: 73a94727f26953a79ffd70902d0f24977b6297d1
version: d6605b7c17ac3b1033ca794886e6142a4141f5b0
subpackages:
- client
- name: github.com/go-openapi/spec
version: 51363c5ae11ba8152bd9f35d17da715fbd1a1136
version: 3faa0055dbbf2110abc1f3b4e3adbb22721e96e7
- name: github.com/go-openapi/strfmt
version: 93a31ef21ac23f317792fff78f9539219dd74619
- name: github.com/go-openapi/swag
@@ -168,11 +168,11 @@ imports:
- name: github.com/go-sql-driver/mysql
version: 3955978caca48c1658a4bb7a9c6a0f084e326af3
- name: github.com/gogo/protobuf
version: eda389564aa83cc6949f47e0524c47cc2e4aaa23
version: fcdc5011193ff531a548e9b0301828d5a5b97fd8
subpackages:
- proto
- name: github.com/golang/protobuf
version: 748d386b5c1ea99658fd69fe9f03991ce86a90c1
version: ab9f9a6dab164b7d1246e0e688b0ab7b94d8553e
subpackages:
- proto
- name: github.com/golang/snappy
@@ -184,11 +184,9 @@ imports:
subpackages:
- query
- name: github.com/gorilla/context
version: 14f550f51af52180c2eefed15e5fd18d63c0a64a
version: 08b5f424b9271eedf6f9f0ce86cb9396ed337a42
- name: github.com/gorilla/mux
version: e444e69cbd2e2e3e0749a2f3c717cec491552bbf
- name: github.com/hashicorp/go-cleanhttp
version: 3573b8b52aa7b37b9358d966a898feb387f62437
version: ac112f7d75a0714af1bd86ab17749b31f7809640
- name: github.com/hashicorp/hcl
version: 392dba7d905ed5d04a5794ba89f558b27e2ba1ca
subpackages:
@@ -213,11 +211,11 @@ imports:
subpackages:
- reflectx
- name: github.com/json-iterator/go
version: 1cfa233923ea407d7f0c70d7a7d835030678e788
version: 887789156aeca0b292a5080b24e650d856c28933
- name: github.com/kr/logfmt
version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0
- name: github.com/lib/pq
version: dd1fe2071026ce53f36a39112e645b4d4f5793a4
version: e42267488fe361b9dc034be7a6bffef5b195bceb
subpackages:
- oid
- name: github.com/magiconair/properties
@@ -248,7 +246,7 @@ imports:
- name: github.com/opentracing-contrib/go-observer
version: a52f2342449246d5bcc273e65cbdcfa5f7d6c63c
- name: github.com/opentracing/opentracing-go
version: 06f47b42c792fef2796e9681353e1d908c417827
version: 8ebe5d4e236eed9fd88e593c288bfb804d630b8c
subpackages:
- ext
- log
@@ -273,21 +271,21 @@ imports:
- name: github.com/pkg/errors
version: c605e284fe17294bda444b34710735b29d1a9d90
- name: github.com/PuerkitoBio/purell
version: b938d81255b5473c57635324295cb0fe398c7a58
version: 7cf257f0a33260797b0febf39f95fccd86aab2a3
- name: github.com/PuerkitoBio/urlesc
version: bbf7a2afc14f93e1e0a5c06df524fbd75e5031e5
version: de5bf2ad457846296e2031421a34e2568e304e35
- name: github.com/rcrowley/go-metrics
version: 1f30fe9094a513ce4c700b9a54458bbb0c96996c
- name: github.com/Shopify/sarama
version: 2fd980e23bdcbb8edeb78fc704de0c39a6567ffc
version: 3fee590c5568849516741670af9331a193bbe2a3
- name: github.com/sirupsen/logrus
version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f
- name: github.com/Sirupsen/logrus
version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f
repo: https://github.com/sirupsen/logrus.git
vcs: git
subpackages:
- hooks/syslog
- name: github.com/sirupsen/logrus
version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f
- name: github.com/spf13/afero
version: 9be650865eab0c12963d8753212f4f9c66cdcf12
subpackages:
@@ -297,7 +295,7 @@ imports:
- name: github.com/spf13/jwalterweatherman
version: 0efa5202c04663c757d84f90f5219c1250baf94f
- name: github.com/spf13/pflag
version: 5644820622454e71517561946e3d94b9f9db6842
version: e57e3eeb33f795204c1ca35f56c44f83227c6e66
- name: github.com/spf13/viper
version: 25b30aa063fc18e48662b86996252eabdcf2f0c7
- name: github.com/ugorji/go
@@ -305,26 +303,28 @@ imports:
subpackages:
- codec
- name: golang.org/x/crypto
version: c10c31b5e94b6f7a0283272dc2bb27163dcea24b
version: b176d7def5d71bdd214203491f89843ed217f420
subpackages:
- bcrypt
- blowfish
- name: golang.org/x/net
version: 4876518f9e71663000c348837735820161a42df7
version: 1c05540f6879653db88113bc4a2b70aec4bd491f
subpackages:
- context
- context/ctxhttp
- idna
- proxy
- name: golang.org/x/sys
version: d8f5ea21b9295e315e612b4bcf4bedea93454d4d
version: 9f7170bcd8e9f4d3691c06401119c46a769a1e03
subpackages:
- unix
- windows
- name: golang.org/x/text
version: 3bd178b88a8180be2df394a1fbb81313916f0e7b
version: e56139fd9c5bc7244c76116c68e500765bb6db6b
subpackages:
- secure/bidirule
- transform
- unicode/bidi
- unicode/norm
- width
- name: gopkg.in/go-playground/validator.v8
@@ -337,5 +337,5 @@ imports:
- internal/sasl
- internal/scram
- name: gopkg.in/yaml.v2
version: 25c4ec802a7d637f88d584ab26798e94ad14c13b
version: eb3733d160e74a9c7e442f435eb3bea458e1d19f
testImports: []

View File

@@ -4,7 +4,7 @@ Purell is a tiny Go library to normalize URLs. It returns a pure URL. Pure-ell.
Based on the [wikipedia paper][wiki] and the [RFC 3986 document][rfc].
[![build status](https://secure.travis-ci.org/PuerkitoBio/purell.png)](http://travis-ci.org/PuerkitoBio/purell)
[![build status](https://travis-ci.org/PuerkitoBio/purell.svg?branch=master)](http://travis-ci.org/PuerkitoBio/purell)
## Install

View File

@@ -1,4 +1,4 @@
urlesc [![Build Status](https://travis-ci.org/PuerkitoBio/urlesc.png?branch=master)](https://travis-ci.org/PuerkitoBio/urlesc) [![GoDoc](http://godoc.org/github.com/PuerkitoBio/urlesc?status.svg)](http://godoc.org/github.com/PuerkitoBio/urlesc)
urlesc [![Build Status](https://travis-ci.org/PuerkitoBio/urlesc.svg?branch=master)](https://travis-ci.org/PuerkitoBio/urlesc) [![GoDoc](http://godoc.org/github.com/PuerkitoBio/urlesc?status.svg)](http://godoc.org/github.com/PuerkitoBio/urlesc)
======
Package urlesc implements query escaping as per RFC 3986.

View File

@@ -297,7 +297,7 @@ func (client *client) Replicas(topic string, partitionID int32) ([]int32, error)
if metadata.Err == ErrReplicaNotAvailable {
return nil, metadata.Err
}
return dupeAndSort(metadata.Replicas), nil
return dupInt32Slice(metadata.Replicas), nil
}
func (client *client) InSyncReplicas(topic string, partitionID int32) ([]int32, error) {
@@ -322,7 +322,7 @@ func (client *client) InSyncReplicas(topic string, partitionID int32) ([]int32,
if metadata.Err == ErrReplicaNotAvailable {
return nil, metadata.Err
}
return dupeAndSort(metadata.Isr), nil
return dupInt32Slice(metadata.Isr), nil
}
func (client *client) Leader(topic string, partitionID int32) (*Broker, error) {

View File

@@ -188,12 +188,12 @@ func TestClientMetadata(t *testing.T) {
replicas, err = client.Replicas("my_topic", 0)
if err != nil {
t.Error(err)
} else if replicas[0] != 1 {
t.Error("Incorrect (or unsorted) replica")
} else if replicas[1] != 3 {
t.Error("Incorrect (or unsorted) replica")
} else if replicas[0] != 3 {
t.Error("Incorrect (or sorted) replica")
} else if replicas[1] != 1 {
t.Error("Incorrect (or sorted) replica")
} else if replicas[2] != 5 {
t.Error("Incorrect (or unsorted) replica")
t.Error("Incorrect (or sorted) replica")
}
isr, err = client.InSyncReplicas("my_topic", 0)
@@ -201,10 +201,10 @@ func TestClientMetadata(t *testing.T) {
t.Error(err)
} else if len(isr) != 2 {
t.Error("Client returned incorrect ISRs for partition:", isr)
} else if isr[0] != 1 {
t.Error("Incorrect (or unsorted) ISR:", isr)
} else if isr[1] != 5 {
t.Error("Incorrect (or unsorted) ISR:", isr)
} else if isr[0] != 5 {
t.Error("Incorrect (or sorted) ISR:", isr)
} else if isr[1] != 1 {
t.Error("Incorrect (or sorted) ISR:", isr)
}
leader.Close()

View File

@@ -247,9 +247,9 @@ func (c *consumer) abandonBrokerConsumer(brokerWorker *brokerConsumer) {
// PartitionConsumer
// PartitionConsumer processes Kafka messages from a given topic and partition. You MUST call Close()
// or AsyncClose() on a PartitionConsumer to avoid leaks, it will not be garbage-collected automatically
// when it passes out of scope.
// PartitionConsumer processes Kafka messages from a given topic and partition. You MUST call one of Close() or
// AsyncClose() on a PartitionConsumer to avoid leaks; it will not be garbage-collected automatically when it passes out
// of scope.
//
// The simplest way of using a PartitionConsumer is to loop over its Messages channel using a for/range
// loop. The PartitionConsumer will only stop itself in one case: when the offset being consumed is reported
@@ -258,19 +258,25 @@ func (c *consumer) abandonBrokerConsumer(brokerWorker *brokerConsumer) {
// By default, it logs these errors to sarama.Logger; if you want to be notified directly of all errors, set
// your config's Consumer.Return.Errors to true and read from the Errors channel, using a select statement
// or a separate goroutine. Check out the Consumer examples to see implementations of these different approaches.
//
// To terminate such a for/range loop while the loop is executing, call AsyncClose. This will kick off the process of
// consumer tear-down & return imediately. Continue to loop, servicing the Messages channel until the teardown process
// AsyncClose initiated closes it (thus terminating the for/range loop). If you've already ceased reading Messages, call
// Close; this will signal the PartitionConsumer's goroutines to begin shutting down (just like AsyncClose), but will
// also drain the Messages channel, harvest all errors & return them once cleanup has completed.
type PartitionConsumer interface {
// AsyncClose initiates a shutdown of the PartitionConsumer. This method will
// return immediately, after which you should wait until the 'messages' and
// 'errors' channel are drained. It is required to call this function, or
// Close before a consumer object passes out of scope, as it will otherwise
// leak memory. You must call this before calling Close on the underlying client.
// AsyncClose initiates a shutdown of the PartitionConsumer. This method will return immediately, after which you
// should continue to service the 'Messages' and 'Errors' channels until they are empty. It is required to call this
// function, or Close before a consumer object passes out of scope, as it will otherwise leak memory. You must call
// this before calling Close on the underlying client.
AsyncClose()
// Close stops the PartitionConsumer from fetching messages. It is required to
// call this function (or AsyncClose) before a consumer object passes out of
// scope, as it will otherwise leak memory. You must call this before calling
// Close on the underlying client.
// Close stops the PartitionConsumer from fetching messages. It will initiate a shutdown just like AsyncClose, drain
// the Messages channel, harvest any errors & return them to the caller. Note that if you are continuing to service
// the Messages channel when this function is called, you will be competing with Close for messages; consider
// calling AsyncClose, instead. It is required to call this function (or AsyncClose) before a consumer object passes
// out of scope, as it will otherwise leak memory. You must call this before calling Close on the underlying client.
Close() error
// Messages returns the read channel for the messages that are returned by

View File

@@ -3,7 +3,6 @@ package sarama
import (
"bufio"
"net"
"sort"
)
type none struct{}
@@ -23,13 +22,11 @@ func (slice int32Slice) Swap(i, j int) {
slice[i], slice[j] = slice[j], slice[i]
}
func dupeAndSort(input []int32) []int32 {
func dupInt32Slice(input []int32) []int32 {
ret := make([]int32, 0, len(input))
for _, val := range input {
ret = append(ret, val)
}
sort.Sort(int32Slice(ret))
return ret
}

View File

@@ -207,13 +207,15 @@ project.lock.json
/lib/delphi/test/typeregistry/*.identcache
/lib/delphi/test/typeregistry/*.local
/lib/delphi/test/typeregistry/*.dcu
/lib/erl/.generated
/lib/erl/.eunit
/lib/erl/ebin
/lib/erl/.generated
/lib/erl/.rebar/
/lib/erl/deps/
/lib/erl/ebin
/lib/erl/src/thrift.app.src
/lib/erl/test/*.hrl
/lib/erl/test/*.beam
/lib/erl/test/*.hrl
/lib/erl/test/Thrift_omit_without.thrift
/lib/haxe/test/bin
/lib/hs/dist
/lib/java/build

View File

@@ -45,7 +45,7 @@ environment:
- PROFILE: MSVC2015
PLATFORM: x64
CONFIGURATION: Release
BOOST_VERSION: 1.63.0
BOOST_VERSION: 1.64.0
LIBEVENT_VERSION: 2.0.22
PYTHON_VERSION: 3.6
QT_VERSION: 5.8
@@ -92,6 +92,10 @@ test_script:
#
# enables RDP at the end of the build job so you can login and re-run
# commands to see why something failed...
# on_finish:
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#
# also need:
# environment:
# APPVEYOR_RDP_PASSWORD: thr1FT2345$xyzZ

View File

@@ -24,10 +24,12 @@ CD "%BUILDDIR%" || EXIT /B
@ECHO ON
cmake "%SRCDIR%" ^
-G"%GENERATOR%" ^
-DBISON_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_bison.exe ^
-DBOOST_ROOT="%BOOST_ROOT%" ^
-DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ^
-DCMAKE_BUILD_TYPE="%CONFIGURATION%" ^
-DCMAKE_INSTALL_PREFIX="%INSTDIR%" ^
-DFLEX_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_flex.exe ^
-DINTTYPES_ROOT="%WIN3P%\msinttypes" ^
-DLIBEVENT_ROOT="%WIN3P%\libevent-%LIBEVENT_VERSION%-stable" ^
-DOPENSSL_ROOT_DIR="%OPENSSL_ROOT%" ^

View File

@@ -70,11 +70,17 @@ set(CMAKE_MACOSX_RPATH TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
#
# C++ Language Level Defaults
# C++ Language Level Defaults - this depends on the compiler capabilities
#
if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11) # C++11
message(STATUS "Setting C++11 as the default language level.")
if (MSVC AND MSVC_VERSION LESS 1800)
# MSVC 2012 and earlier don't support template aliases so you have to use C++98
set(CMAKE_CXX_STANDARD 98)
message(STATUS "Setting C++98 as the default language level (for an older MSVC compiler).")
else()
set(CMAKE_CXX_STANDARD 11) # C++11
message(STATUS "Setting C++11 as the default language level.")
endif()
message(STATUS "To specify a different C++ language level, set CMAKE_CXX_STANDARD")
endif()

View File

@@ -40,6 +40,16 @@ option(BUILD_LIBRARIES "Build Thrift libraries" ON)
# and enables the library if all are found. This means the default is to build as
# much as possible but leaving out libraries if their dependencies are not met.
option(WITH_BOOST_FUNCTIONAL "Use boost/tr1/functional.hpp even under C++11 or later" OFF)
if (WITH_BOOST_FUNCTIONAL)
add_definitions(-DFORCE_BOOST_FUNCTIONAL)
endif()
option(WITH_BOOST_SMART_PTR "Use boost/smart_ptr.hpp even under C++11 or later" OFF)
if (WITH_BOOST_SMART_PTR)
add_definitions(-DFORCE_BOOST_SMART_PTR)
endif()
option(WITH_BOOST_STATIC "Build with Boost static link library" OFF)
set(Boost_USE_STATIC_LIBS ${WITH_BOOST_STATIC})
if (NOT WITH_BOOST_STATIC)
@@ -197,6 +207,8 @@ message(STATUS " Build shared libraries: ${WITH_SHARED_LIB}
message(STATUS " Build static libraries: ${WITH_STATIC_LIB}")
message(STATUS " Build with Boost static link library: ${WITH_BOOST_STATIC}")
message(STATUS " Build with Boost thread support: ${WITH_BOOSTTHREADS}")
message(STATUS " Build with boost/tr1/functional (forced) ${WITH_BOOST_FUNCTIONAL}")
message(STATUS " Build with boost/smart_ptr (forced) ${WITH_BOOST_SMART_PTR}")
message(STATUS " Build with C++ std::thread support: ${WITH_STDTHREADS}")
message(STATUS " Build with libevent support: ${WITH_LIBEVENT}")
message(STATUS " Build with OpenSSL support: ${WITH_OPENSSL}")

View File

@@ -109,7 +109,10 @@ if (CMAKE_CXX_EXTENSIONS)
string(CONCAT CXX_LANGUAGE_LEVEL "${CXX_LANGUAGE_LEVEL} [with compiler-specific extensions]")
else()
if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND NOT MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-variadic-macros -Wno-long-long -Wno-c++11-long-long")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-variadic-macros -Wno-long-long")
endif()
if ((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND NOT MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-long-long")
endif()
endif()
@@ -117,8 +120,12 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register")
endif()
# If gcc older than 4.8 is detected and plugin support was requested, fail fast
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8" AND WITH_PLUGIN)
message(SEND_ERROR "Thrift compiler plug-in support is not possible with older gcc ( < 4.8 ) compiler")
# Building WITH_PLUGIN requires boost memory operations, for now, and gcc >= 4.8
if (WITH_PLUGIN)
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8")
message(SEND_ERROR "Thrift compiler plug-in support is not possible with older gcc ( < 4.8 ) compiler")
endif()
message(STATUS "Forcing use of boost::smart_ptr to build WITH_PLUGIN")
add_definitions("-DFORCE_BOOST_SMART_PTR=1")
endif()

View File

@@ -36,6 +36,7 @@ if(NEWPLATFORMDEBUG)
SHOWFLAG("CYGWIN")
SHOWFLAG("MINGW")
SHOWFLAG("MSVC")
SHOWFLAG("MSVC_VERSION")
SHOWFLAG("MSYS")
SHOWFLAG("UNIX")
SHOWFLAG("WATCOM")

View File

@@ -409,7 +409,7 @@ void t_cpp_generator::init_generator() {
<< "#include <thrift/transport/TTransport.h>" << endl
<< endl;
// Include C++xx compatibility header
f_types_ << "#include <thrift/cxxfunctional.h>" << endl;
f_types_ << "#include <thrift/stdcxx.h>" << endl;
// Include other Thrift includes
const vector<t_program*>& includes = program_->get_includes();
@@ -1108,7 +1108,7 @@ void t_cpp_generator::generate_struct_declaration(ofstream& out,
continue;
}
if (is_reference((*m_iter))) {
out << endl << indent() << "void __set_" << (*m_iter)->get_name() << "(boost::shared_ptr<"
out << endl << indent() << "void __set_" << (*m_iter)->get_name() << "(::apache::thrift::stdcxx::shared_ptr<"
<< type_name((*m_iter)->get_type(), false, false) << ">";
out << " val);" << endl;
} else {
@@ -1228,7 +1228,7 @@ void t_cpp_generator::generate_struct_definition(ofstream& out,
if (is_reference((*m_iter))) {
std::string type = type_name((*m_iter)->get_type());
out << endl << indent() << "void " << tstruct->get_name() << "::__set_"
<< (*m_iter)->get_name() << "(boost::shared_ptr<"
<< (*m_iter)->get_name() << "(::apache::thrift::stdcxx::shared_ptr<"
<< type_name((*m_iter)->get_type(), false, false) << ">";
out << " val) {" << endl;
} else {
@@ -1276,7 +1276,7 @@ void t_cpp_generator::generate_struct_reader(ofstream& out, t_struct* tstruct, b
// Declare stack tmp variables
out << endl
<< indent() << "apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);" << endl
<< indent() << "::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);" << endl
<< indent() << "uint32_t xfer = 0;" << endl
<< indent() << "std::string fname;" << endl
<< indent() << "::apache::thrift::protocol::TType ftype;" << endl
@@ -1400,7 +1400,7 @@ void t_cpp_generator::generate_struct_writer(ofstream& out, t_struct* tstruct, b
out << indent() << "uint32_t xfer = 0;" << endl;
indent(out) << "apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);" << endl;
indent(out) << "::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);" << endl;
indent(out) << "xfer += oprot->writeStructBegin(\"" << name << "\");" << endl;
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
@@ -1707,7 +1707,7 @@ void t_cpp_generator::generate_service(t_service* tservice) {
<< endl;
if (gen_cob_style_) {
f_header_ << "#include <thrift/transport/TBufferTransports.h>" << endl << // TMemoryBuffer
"#include <thrift/cxxfunctional.h>" << endl
"#include <thrift/stdcxx.h>" << endl
<< "namespace apache { namespace thrift { namespace async {" << endl
<< "class TAsyncChannel;" << endl << "}}}" << endl;
}
@@ -1949,7 +1949,7 @@ void t_cpp_generator::generate_service_interface_factory(t_service* tservice, st
f_header_ << "class " << singleton_factory_name << " : virtual public " << factory_name << " {"
<< endl << " public:" << endl;
indent_up();
f_header_ << indent() << singleton_factory_name << "(const boost::shared_ptr<" << service_if_name
f_header_ << indent() << singleton_factory_name << "(const ::apache::thrift::stdcxx::shared_ptr<" << service_if_name
<< ">& iface) : iface_(iface) {}" << endl << indent() << "virtual ~"
<< singleton_factory_name << "() {}" << endl << endl << indent() << "virtual "
<< service_if_name << "* getHandler("
@@ -1957,7 +1957,7 @@ void t_cpp_generator::generate_service_interface_factory(t_service* tservice, st
<< " return iface_.get();" << endl << indent() << "}" << endl << indent()
<< "virtual void releaseHandler(" << base_if_name << "* /* handler */) {}" << endl;
f_header_ << endl << " protected:" << endl << indent() << "boost::shared_ptr<" << service_if_name
f_header_ << endl << " protected:" << endl << indent() << "::apache::thrift::stdcxx::shared_ptr<" << service_if_name
<< "> iface_;" << endl;
indent_down();
@@ -2065,8 +2065,7 @@ void t_cpp_generator::generate_service_async_skeleton(t_service* tservice) {
<< "using namespace ::apache::thrift;" << endl
<< "using namespace ::apache::thrift::protocol;" << endl
<< "using namespace ::apache::thrift::transport;" << endl
<< "using namespace ::apache::thrift::async;" << endl << endl
<< "using boost::shared_ptr;" << endl << endl;
<< "using namespace ::apache::thrift::async;" << endl << endl;
// the following code would not compile:
// using namespace ;
@@ -2128,7 +2127,7 @@ void t_cpp_generator::generate_service_multiface(t_service* tservice) {
extends_multiface = ", public " + extends + "Multiface";
}
string list_type = string("std::vector<boost::shared_ptr<") + service_name_ + "If> >";
string list_type = string("std::vector<apache::thrift::stdcxx::shared_ptr<") + service_name_ + "If> >";
// Generate the header portion
f_header_ << "class " << service_name_ << "Multiface : "
@@ -2139,7 +2138,7 @@ void t_cpp_generator::generate_service_multiface(t_service* tservice) {
<< "& ifaces) : ifaces_(ifaces) {" << endl;
if (!extends.empty()) {
f_header_ << indent()
<< " std::vector<boost::shared_ptr<" + service_name_ + "If> >::iterator iter;"
<< " std::vector<apache::thrift::stdcxx::shared_ptr<" + service_name_ + "If> >::iterator iter;"
<< endl << indent() << " for (iter = ifaces.begin(); iter != ifaces.end(); ++iter) {"
<< endl << indent() << " " << extends << "Multiface::add(*iter);" << endl
<< indent() << " }" << endl;
@@ -2152,7 +2151,7 @@ void t_cpp_generator::generate_service_multiface(t_service* tservice) {
f_header_ << " protected:" << endl;
indent_up();
f_header_ << indent() << list_type << " ifaces_;" << endl << indent() << service_name_
<< "Multiface() {}" << endl << indent() << "void add(boost::shared_ptr<"
<< "Multiface() {}" << endl << indent() << "void add(::apache::thrift::stdcxx::shared_ptr<"
<< service_name_ << "If> iface) {" << endl;
if (!extends.empty()) {
f_header_ << indent() << " " << extends << "Multiface::add(iface);" << endl;
@@ -2234,7 +2233,7 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
} else {
protocol_type = "::apache::thrift::protocol::TProtocol";
}
string prot_ptr = "boost::shared_ptr< " + protocol_type + ">";
string prot_ptr = "apache::thrift::stdcxx::shared_ptr< " + protocol_type + ">";
string client_suffix = "Client" + template_suffix;
string if_suffix = "If";
if (style == "Cob") {
@@ -2311,18 +2310,18 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
// Note that these are not currently templated for simplicity.
// TODO(simpkins): should they be templated?
f_header_ << indent()
<< "boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {"
<< "apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {"
<< endl << indent() << " return " << _this << "piprot_;" << endl << indent() << "}"
<< endl;
f_header_ << indent()
<< "boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {"
<< "apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {"
<< endl << indent() << " return " << _this << "poprot_;" << endl << indent() << "}"
<< endl;
} else /* if (style == "Cob") */ {
f_header_ << indent() << service_name_ << style << "Client" << short_suffix << "("
<< "boost::shared_ptr< ::apache::thrift::async::TAsyncChannel> channel, "
<< "apache::thrift::stdcxx::shared_ptr< ::apache::thrift::async::TAsyncChannel> channel, "
<< "::apache::thrift::protocol::TProtocolFactory* protocolFactory) :" << endl;
if (extends.empty()) {
f_header_ << indent() << " channel_(channel)," << endl << indent()
@@ -2332,9 +2331,9 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
if (gen_templates_) {
// TProtocolFactory classes return generic TProtocol pointers.
// We have to dynamic cast to the Protocol_ type we are expecting.
f_header_ << indent() << " piprot_(boost::dynamic_pointer_cast<Protocol_>("
f_header_ << indent() << " piprot_(::apache::thrift::stdcxx::dynamic_pointer_cast<Protocol_>("
<< "protocolFactory->getProtocol(itrans_)))," << endl << indent()
<< " poprot_(boost::dynamic_pointer_cast<Protocol_>("
<< " poprot_(::apache::thrift::stdcxx::dynamic_pointer_cast<Protocol_>("
<< "protocolFactory->getProtocol(otrans_))) {" << endl;
// Throw a TException if either dynamic cast failed.
f_header_ << indent() << " if (!piprot_ || !poprot_) {" << endl << indent()
@@ -2356,7 +2355,7 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
if (style == "Cob") {
f_header_ << indent()
<< "boost::shared_ptr< ::apache::thrift::async::TAsyncChannel> getChannel() {" << endl
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::async::TAsyncChannel> getChannel() {" << endl
<< indent() << " return " << _this << "channel_;" << endl << indent() << "}" << endl;
if (!gen_no_client_completion_) {
f_header_ << indent() << "virtual void completed__(bool /* success */) {}" << endl;
@@ -2408,11 +2407,11 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
if (style == "Cob") {
f_header_ << indent()
<< "boost::shared_ptr< ::apache::thrift::async::TAsyncChannel> channel_;" << endl
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::async::TAsyncChannel> channel_;" << endl
<< indent()
<< "boost::shared_ptr< ::apache::thrift::transport::TMemoryBuffer> itrans_;" << endl
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::transport::TMemoryBuffer> itrans_;" << endl
<< indent()
<< "boost::shared_ptr< ::apache::thrift::transport::TMemoryBuffer> otrans_;"
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::transport::TMemoryBuffer> otrans_;"
<< endl;
}
f_header_ <<
@@ -2494,11 +2493,11 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
} else {
if (!(*f_iter)->is_oneway()) {
out << indent() << _this << "channel_->sendAndRecvMessage("
<< "tcxx::bind(cob, this), " << _this << "otrans_.get(), " << _this << "itrans_.get());"
<< "::apache::thrift::stdcxx::bind(cob, this), " << _this << "otrans_.get(), " << _this << "itrans_.get());"
<< endl;
} else {
out << indent() << _this << "channel_->sendMessage("
<< "tcxx::bind(cob, this), " << _this << "otrans_.get());" << endl;
<< "::apache::thrift::stdcxx::bind(cob, this), " << _this << "otrans_.get());" << endl;
}
}
scope_down(out);
@@ -2849,8 +2848,8 @@ ProcessorGenerator::ProcessorGenerator(t_cpp_generator* generator,
class_name_ = service_name_ + pstyle_ + "Processor";
if_name_ = service_name_ + "CobSvIf";
finish_cob_ = "tcxx::function<void(bool ok)> cob, ";
finish_cob_decl_ = "tcxx::function<void(bool ok)>, ";
finish_cob_ = "::apache::thrift::stdcxx::function<void(bool ok)> cob, ";
finish_cob_decl_ = "::apache::thrift::stdcxx::function<void(bool ok)>, ";
cob_arg_ = "cob, ";
ret_type_ = "void ";
} else {
@@ -2911,7 +2910,7 @@ void ProcessorGenerator::generate_class_definition() {
// Protected data members
f_header_ << " protected:" << endl;
indent_up();
f_header_ << indent() << "boost::shared_ptr<" << if_name_ << "> iface_;" << endl;
f_header_ << indent() << "::apache::thrift::stdcxx::shared_ptr<" << if_name_ << "> iface_;" << endl;
f_header_ << indent() << "virtual " << ret_type_ << "dispatchCall(" << finish_cob_
<< "::apache::thrift::protocol::TProtocol* iprot, "
<< "::apache::thrift::protocol::TProtocol* oprot, "
@@ -2967,29 +2966,29 @@ void ProcessorGenerator::generate_class_definition() {
? ""
: ", const " + type_name((*f_iter)->get_returntype()) + "& _return");
f_header_ << indent() << "void return_" << (*f_iter)->get_name()
<< "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "::apache::thrift::protocol::TProtocol* oprot, "
<< "void* ctx" << ret_arg << ");" << endl;
if (generator_->gen_templates_) {
f_header_ << indent() << "void return_" << (*f_iter)->get_name()
<< "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "Protocol_* oprot, void* ctx" << ret_arg << ");" << endl;
}
// XXX Don't declare throw if it doesn't exist
f_header_ << indent() << "void throw_" << (*f_iter)->get_name()
<< "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "::apache::thrift::protocol::TProtocol* oprot, void* ctx, "
<< "::apache::thrift::TDelayedException* _throw);" << endl;
if (generator_->gen_templates_) {
f_header_ << indent() << "void throw_" << (*f_iter)->get_name()
<< "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< "Protocol_* oprot, void* ctx, "
<< "::apache::thrift::TDelayedException* _throw);" << endl;
}
}
}
f_header_ << " public:" << endl << indent() << class_name_ << "(boost::shared_ptr<" << if_name_
f_header_ << " public:" << endl << indent() << class_name_ << "(::apache::thrift::stdcxx::shared_ptr<" << if_name_
<< "> iface) :" << endl;
if (!extends_.empty()) {
f_header_ << indent() << " " << extends_ << "(iface)," << endl;
@@ -3127,14 +3126,14 @@ void ProcessorGenerator::generate_factory() {
<< endl << " public:" << endl;
indent_up();
f_header_ << indent() << factory_class_name_ << "(const ::boost::shared_ptr< " << if_factory_name
f_header_ << indent() << factory_class_name_ << "(const ::apache::thrift::stdcxx::shared_ptr< " << if_factory_name
<< " >& handlerFactory) :" << endl << indent()
<< " handlerFactory_(handlerFactory) {}" << endl << endl << indent()
<< "::boost::shared_ptr< ::apache::thrift::"
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::"
<< (style_ == "Cob" ? "async::TAsyncProcessor" : "TProcessor") << " > "
<< "getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);" << endl;
f_header_ << endl << " protected:" << endl << indent() << "::boost::shared_ptr< "
f_header_ << endl << " protected:" << endl << indent() << "::apache::thrift::stdcxx::shared_ptr< "
<< if_factory_name << " > handlerFactory_;" << endl;
indent_down();
@@ -3149,17 +3148,17 @@ void ProcessorGenerator::generate_factory() {
}
// Generate the getProcessor() method
f_out_ << template_header_ << indent() << "::boost::shared_ptr< ::apache::thrift::"
f_out_ << template_header_ << indent() << "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::"
<< (style_ == "Cob" ? "async::TAsyncProcessor" : "TProcessor") << " > "
<< factory_class_name_ << template_suffix_ << "::getProcessor("
<< "const ::apache::thrift::TConnectionInfo& connInfo) {" << endl;
indent_up();
f_out_ << indent() << "::apache::thrift::ReleaseHandler< " << if_factory_name
<< " > cleanup(handlerFactory_);" << endl << indent() << "::boost::shared_ptr< "
<< " > cleanup(handlerFactory_);" << endl << indent() << "::apache::thrift::stdcxx::shared_ptr< "
<< if_name_ << " > handler("
<< "handlerFactory_->getHandler(connInfo), cleanup);" << endl << indent()
<< "::boost::shared_ptr< ::apache::thrift::"
<< "::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::"
<< (style_ == "Cob" ? "async::TAsyncProcessor" : "TProcessor") << " > "
<< "processor(new " << class_name_ << template_suffix_ << "(handler));" << endl << indent()
<< "return processor;" << endl;
@@ -3394,7 +3393,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
out << indent() << "template <class Protocol_>" << endl;
}
out << "void " << tservice->get_name() << "AsyncProcessor" << class_suffix << "::process_"
<< tfunction->get_name() << "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< tfunction->get_name() << "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< prot_type << "* iprot, " << prot_type << "* oprot)" << endl;
scope_up(out);
@@ -3451,28 +3450,28 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
// No return. Just hand off our cob.
// TODO(dreiss): Call the cob immediately?
out << indent() << "iface_->" << tfunction->get_name() << "("
<< "tcxx::bind(cob, true)" << endl;
<< "::apache::thrift::stdcxx::bind(cob, true)" << endl;
indent_up();
indent_up();
} else {
string ret_arg, ret_placeholder;
if (!tfunction->get_returntype()->is_void()) {
ret_arg = ", const " + type_name(tfunction->get_returntype()) + "& _return";
ret_placeholder = ", tcxx::placeholders::_1";
ret_placeholder = ", ::apache::thrift::stdcxx::placeholders::_1";
}
// When gen_templates_ is true, the return_ and throw_ functions are
// overloaded. We have to declare pointers to them so that the compiler
// can resolve the correct overloaded version.
out << indent() << "void (" << tservice->get_name() << "AsyncProcessor" << class_suffix
<< "::*return_fn)(tcxx::function<void(bool ok)> "
<< "::*return_fn)(::apache::thrift::stdcxx::function<void(bool ok)> "
<< "cob, int32_t seqid, " << prot_type << "* oprot, void* ctx" << ret_arg
<< ") =" << endl;
out << indent() << " &" << tservice->get_name() << "AsyncProcessor" << class_suffix
<< "::return_" << tfunction->get_name() << ";" << endl;
if (!xceptions.empty()) {
out << indent() << "void (" << tservice->get_name() << "AsyncProcessor" << class_suffix
<< "::*throw_fn)(tcxx::function<void(bool ok)> "
<< "::*throw_fn)(::apache::thrift::stdcxx::function<void(bool ok)> "
<< "cob, int32_t seqid, " << prot_type << "* oprot, void* ctx, "
<< "::apache::thrift::TDelayedException* _throw) =" << endl;
out << indent() << " &" << tservice->get_name() << "AsyncProcessor" << class_suffix
@@ -3482,11 +3481,11 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
out << indent() << "iface_->" << tfunction->get_name() << "(" << endl;
indent_up();
indent_up();
out << indent() << "tcxx::bind(return_fn, this, cob, seqid, oprot, ctx" << ret_placeholder
out << indent() << "::apache::thrift::stdcxx::bind(return_fn, this, cob, seqid, oprot, ctx" << ret_placeholder
<< ")";
if (!xceptions.empty()) {
out << ',' << endl << indent() << "tcxx::bind(throw_fn, this, cob, seqid, oprot, "
<< "ctx, tcxx::placeholders::_1)";
out << ',' << endl << indent() << "::apache::thrift::stdcxx::bind(throw_fn, this, cob, seqid, oprot, "
<< "ctx, ::apache::thrift::stdcxx::placeholders::_1)";
}
}
@@ -3511,7 +3510,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
out << indent() << "template <class Protocol_>" << endl;
}
out << "void " << tservice->get_name() << "AsyncProcessor" << class_suffix << "::return_"
<< tfunction->get_name() << "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< tfunction->get_name() << "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< prot_type << "* oprot, void* ctx" << ret_arg_decl << ')' << endl;
scope_up(out);
@@ -3559,7 +3558,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice,
out << indent() << "template <class Protocol_>" << endl;
}
out << "void " << tservice->get_name() << "AsyncProcessor" << class_suffix << "::throw_"
<< tfunction->get_name() << "(tcxx::function<void(bool ok)> cob, int32_t seqid, "
<< tfunction->get_name() << "(::apache::thrift::stdcxx::function<void(bool ok)> cob, int32_t seqid, "
<< prot_type << "* oprot, void* ctx, "
<< "::apache::thrift::TDelayedException* _throw)" << endl;
scope_up(out);
@@ -3659,8 +3658,7 @@ void t_cpp_generator::generate_service_skeleton(t_service* tservice) {
<< "using namespace ::apache::thrift;" << endl
<< "using namespace ::apache::thrift::protocol;" << endl
<< "using namespace ::apache::thrift::transport;" << endl
<< "using namespace ::apache::thrift::server;" << endl << endl
<< "using boost::shared_ptr;" << endl << endl;
<< "using namespace ::apache::thrift::server;" << endl << endl;
// the following code would not compile:
// using namespace ;
@@ -3690,13 +3688,13 @@ void t_cpp_generator::generate_service_skeleton(t_service* tservice) {
f_skeleton << indent() << "int main(int argc, char **argv) {" << endl;
indent_up();
f_skeleton
<< indent() << "int port = 9090;" << endl << indent() << "shared_ptr<" << svcname
<< indent() << "int port = 9090;" << endl << indent() << "::apache::thrift::stdcxx::shared_ptr<" << svcname
<< "Handler> handler(new " << svcname << "Handler());" << endl << indent()
<< "shared_ptr<TProcessor> processor(new " << svcname << "Processor(handler));" << endl
<< indent() << "shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));"
<< "::apache::thrift::stdcxx::shared_ptr<TProcessor> processor(new " << svcname << "Processor(handler));" << endl
<< indent() << "::apache::thrift::stdcxx::shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));"
<< endl << indent()
<< "shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());" << endl
<< indent() << "shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());"
<< "::apache::thrift::stdcxx::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());" << endl
<< indent() << "::apache::thrift::stdcxx::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());"
<< endl << endl << indent()
<< "TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);"
<< endl << indent() << "server.serve();" << endl << indent() << "return 0;" << endl;
@@ -3785,7 +3783,7 @@ void t_cpp_generator::generate_deserialize_struct(ofstream& out,
bool pointer) {
if (pointer) {
indent(out) << "if (!" << prefix << ") { " << endl;
indent(out) << " " << prefix << " = boost::shared_ptr<" << type_name(tstruct) << ">(new "
indent(out) << " " << prefix << " = ::apache::thrift::stdcxx::shared_ptr<" << type_name(tstruct) << ">(new "
<< type_name(tstruct) << ");" << endl;
indent(out) << "}" << endl;
indent(out) << "xfer += " << prefix << "->read(iprot);" << endl;
@@ -4277,7 +4275,7 @@ string t_cpp_generator::declare_field(t_field* tfield,
}
result += type_name(tfield->get_type());
if (is_reference(tfield)) {
result = "boost::shared_ptr<" + result + ">";
result = "::apache::thrift::stdcxx::shared_ptr<" + result + ">";
}
if (pointer) {
result += "*";
@@ -4356,13 +4354,13 @@ string t_cpp_generator::function_signature(t_function* tfunction,
cob_type = (ttype->is_void() ? "()" : ("(" + type_name(ttype) + " const& _return)"));
if (has_xceptions) {
exn_cob
= ", tcxx::function<void(::apache::thrift::TDelayedException* _throw)> /* exn_cob */";
= ", ::apache::thrift::stdcxx::function<void(::apache::thrift::TDelayedException* _throw)> /* exn_cob */";
}
} else {
throw "UNKNOWN STYLE";
}
return "void " + prefix + tfunction->get_name() + "(tcxx::function<void" + cob_type + "> cob"
return "void " + prefix + tfunction->get_name() + "(::apache::thrift::stdcxx::function<void" + cob_type + "> cob"
+ exn_cob + argument_list(arglist, name_params, true) + ")";
} else {
throw "UNKNOWN STYLE";

View File

@@ -266,8 +266,8 @@ void t_erl_generator::init_generator() {
<< "-module(" << program_module_name << "_types)." << endl
<< erl_imports() << endl;
f_types_file_ << "-include(\"" << f_types_hrl_name << "\")." << endl
<< endl;
f_types_file_ << "-include(\"" << program_module_name << "_types.hrl\")." << endl
<< endl;
f_types_hrl_file_ << render_includes() << endl;
@@ -281,11 +281,11 @@ void t_erl_generator::init_generator() {
f_consts_file_ << erl_autogen_comment() << endl
<< "-module(" << program_module_name << "_constants)." << endl
<< erl_imports() << endl
<< "-include(\"" << f_types_hrl_name << "\")." << endl
<< "-include(\"" << program_module_name << "_types.hrl\")." << endl
<< endl;
f_consts_hrl_file_ << erl_autogen_comment() << endl << erl_imports() << endl
<< "-include(\"" << f_types_hrl_name << "\")." << endl << endl;
<< "-include(\"" << program_module_name << "_types.hrl\")." << endl << endl;
}
/**

View File

@@ -1483,11 +1483,20 @@ void t_js_generator::generate_service_client(t_service* tservice) {
<< "', " << messageType << ", this.seqid);" << endl;
}
f_service_ << indent() << "var args = new " << argsname << "();" << endl;
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
f_service_ << indent() << "args." << (*fld_iter)->get_name() << " = "
<< (*fld_iter)->get_name() << ";" << endl;
if (fields.size() > 0){
f_service_ << indent() << "var params = {" << endl;
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
f_service_ << indent() << indent() << (*fld_iter)->get_name() << ": " << (*fld_iter)->get_name();
if (fld_iter != fields.end()-1) {
f_service_ << "," << endl;
} else {
f_service_ << endl;
}
}
f_service_ << indent() << "};" << endl;
f_service_ << indent() << "var args = new " << argsname << "(params);" << endl;
} else {
f_service_ << indent() << "var args = new " << argsname << "();" << endl;
}
// Write to the stream

View File

@@ -27,17 +27,15 @@
#include <cassert>
#include <iostream>
#include <boost/bind.hpp>
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/for_each.hpp>
#include <boost/smart_ptr.hpp>
#include "thrift/generate/t_generator.h"
#include "thrift/plugin/type_util.h"
#include "thrift/protocol/TBinaryProtocol.h"
#include "thrift/transport/TBufferTransports.h"
#include "thrift/transport/TFDTransport.h"
#include "thrift/stdcxx.h"
#include "thrift/plugin/plugin_types.h"
namespace apache {
@@ -121,7 +119,7 @@ struct TypeCache {
void compileAll() {
boost::for_each(*source | boost::adaptors::map_keys,
boost::bind(&TypeCache::compile, this, _1));
stdcxx::bind(&TypeCache::compile, this, stdcxx::placeholders::_1));
}
std::map<int64_t, S> const* source;
@@ -218,7 +216,7 @@ THRIFT_CONVERSION(t_enum, g_program_cache[from.metadata.program_id]) {
assert(to);
THRIFT_ASSIGN_METADATA();
boost::for_each(from.constants | boost::adaptors::transformed(convert<t_enum_value>),
boost::bind(&::t_enum::append, to, _1));
stdcxx::bind(&::t_enum::append, to, stdcxx::placeholders::_1));
}
THRIFT_CONVERSION(t_list, resolve_type< ::t_type>(from.elem_type)) {
assert(to);
@@ -255,7 +253,7 @@ THRIFT_CONVERSION(t_const_value, ) {
} else if (from.__isset.list_val) {
to->set_list();
boost::for_each(from.list_val | boost::adaptors::transformed(&convert<t_const_value>),
boost::bind(&::t_const_value::add_list, to, _1));
stdcxx::bind(&::t_const_value::add_list, to, stdcxx::placeholders::_1));
} else
T_CONST_VALUE_CASE(string);
else T_CONST_VALUE_CASE(integer);
@@ -282,7 +280,7 @@ THRIFT_CONVERSION(t_struct, g_program_cache[from.metadata.program_id]) {
to->set_union(from.is_union);
to->set_xception(from.is_xception);
boost::for_each(from.members | boost::adaptors::transformed(convert<t_field>),
boost::bind(&::t_struct::append, to, _1));
stdcxx::bind(&::t_struct::append, to, stdcxx::placeholders::_1));
}
THRIFT_CONVERSION(t_const,
resolve_type< ::t_type>(from.type),
@@ -309,7 +307,7 @@ THRIFT_CONVERSION(t_service, g_program_cache[from.metadata.program_id]) {
THRIFT_ASSIGN_METADATA();
boost::for_each(from.functions | boost::adaptors::transformed(convert<t_function>),
boost::bind(&::t_service::add_function, to, _1));
stdcxx::bind(&::t_service::add_function, to, stdcxx::placeholders::_1));
if (from.__isset.extends_)
to->set_extends(resolve_service(from.extends_));
@@ -390,9 +388,9 @@ THRIFT_CONVERT_COMPLETE(t_program) {
to->set_out_path(from.out_path, from.out_path_is_absolute);
boost::for_each(from.typedefs | boost::adaptors::transformed(&resolve_type< ::t_typedef>),
boost::bind(&::t_program::add_typedef, to, _1));
stdcxx::bind(&::t_program::add_typedef, to, stdcxx::placeholders::_1));
boost::for_each(from.enums | boost::adaptors::transformed(&resolve_type< ::t_enum>),
boost::bind(&::t_program::add_enum, to, _1));
stdcxx::bind(&::t_program::add_enum, to, stdcxx::placeholders::_1));
for (std::vector<int64_t>::const_iterator it = from.objects.begin(); it != from.objects.end();
it++) {
::t_struct* t2 = resolve_type< ::t_struct>(*it);
@@ -403,18 +401,18 @@ THRIFT_CONVERT_COMPLETE(t_program) {
}
}
boost::for_each(from.consts | boost::adaptors::transformed(&resolve_const),
boost::bind(&::t_program::add_const, to, _1));
stdcxx::bind(&::t_program::add_const, to, stdcxx::placeholders::_1));
boost::for_each(from.services | boost::adaptors::transformed(&resolve_service),
boost::bind(&::t_program::add_service, to, _1));
stdcxx::bind(&::t_program::add_service, to, stdcxx::placeholders::_1));
for (std::vector<t_program>::const_iterator it = from.includes.begin(); it != from.includes.end();
it++) {
convert(*it, g_program_cache[it->program_id]);
}
std::for_each(from.c_includes.begin(), from.c_includes.end(),
boost::bind(&::t_program::add_c_include, to, _1));
stdcxx::bind(&::t_program::add_c_include, to, stdcxx::placeholders::_1));
std::for_each(from.cpp_includes.begin(), from.cpp_includes.end(),
boost::bind(&::t_program::add_cpp_include, to, _1));
stdcxx::bind(&::t_program::add_cpp_include, to, stdcxx::placeholders::_1));
for (std::map<std::string, std::string>::const_iterator it = from.namespaces.begin();
it != from.namespaces.end(); it++) {
to->set_namespace(it->first, it->second);
@@ -428,8 +426,8 @@ int GeneratorPlugin::exec(int, char* []) {
#ifdef _WIN32
_setmode(fileno(stdin), _O_BINARY);
#endif
boost::shared_ptr<TFramedTransport> transport(
new TFramedTransport(boost::make_shared<TFDTransport>(fileno(stdin))));
stdcxx::shared_ptr<TFramedTransport> transport(
new TFramedTransport(stdcxx::make_shared<TFDTransport>(fileno(stdin))));
TBinaryProtocol proto(transport);
GeneratorInput input;
try {

View File

@@ -34,12 +34,12 @@
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/algorithm/transform.hpp>
#include <boost/smart_ptr.hpp>
#include "thrift/generate/t_generator.h"
#include "thrift/plugin/plugin.h"
#include "thrift/plugin/type_util.h"
#include "thrift/protocol/TBinaryProtocol.h"
#include "thrift/stdcxx.h"
#include "thrift/transport/TBufferTransports.h"
#include "thrift/transport/TFDTransport.h"
@@ -55,6 +55,8 @@ typename apache::thrift::plugin::ToType<From>::type convert(From* from) {
}
using apache::thrift::protocol::TBinaryProtocol;
using apache::thrift::stdcxx::make_shared;
using apache::thrift::stdcxx::shared_ptr;
using apache::thrift::transport::TFDTransport;
using apache::thrift::transport::TFramedTransport;
@@ -377,8 +379,8 @@ PluginDelegateResult delegateToPlugin(t_program* program, const std::string& opt
#ifdef _WIN32
_setmode(fileno(fd), _O_BINARY);
#endif
boost::shared_ptr<TFramedTransport> transport(
new TFramedTransport(boost::make_shared<TFDTransport>(fileno(fd))));
shared_ptr<TFramedTransport> transport(
new TFramedTransport(make_shared<TFDTransport>(fileno(fd))));
TBinaryProtocol proto(transport);
plugin::GeneratorInput input;

View File

@@ -17,7 +17,7 @@
* under the License.
*/
/* test a C client with a C++ server */
/* test a C client with a C++ server (that makes sense...) */
#include <signal.h>
#include <sys/types.h>
@@ -25,23 +25,34 @@
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/protocol/TDebugProtocol.h>
#include <thrift/server/TSimpleServer.h>
#include <thrift/stdcxx.h>
#include <thrift/transport/TServerSocket.h>
#include "ThriftTest.h"
#include "ThriftTest_types.h"
#include <iostream>
using namespace std;
using namespace boost;
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace apache::thrift;
using namespace apache::thrift::concurrency;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;
using namespace apache::thrift::server;
using namespace apache::thrift::transport;
using namespace thrift::test;
using std::cout;
using std::endl;
using std::fixed;
using std::make_pair;
using std::map;
using std::set;
using std::string;
using std::vector;
#define TEST_PORT 9980
// Extra functions required for ThriftTest_types to work
@@ -347,7 +358,7 @@ test_thrift_client (void)
gchar *string = NULL;
gint8 byte = 0;
gint16 i16 = 0;
gint32 i32 = 0, another_i32 = 56789;
gint32 i32 = 0, another_i32 = 56789;
gint64 i64 = 0;
double dbl = 0.0;
TTestXtruct *xtruct_in, *xtruct_out;
@@ -356,7 +367,7 @@ test_thrift_client (void)
GHashTable *set_in = NULL, *set_out = NULL;
GArray *list_in = NULL, *list_out = NULL;
TTestNumberz enum_in, enum_out;
TTestUserId user_id_in, user_id_out;
TTestUserId user_id_in, user_id_out;
GHashTable *insanity_in = NULL;
TTestXtruct *xtruct1, *xtruct2;
TTestInsanity *insanity_out = NULL;
@@ -371,7 +382,7 @@ test_thrift_client (void)
#endif
// create a C client
tsocket = (ThriftSocket *) g_object_new (THRIFT_TYPE_SOCKET,
tsocket = (ThriftSocket *) g_object_new (THRIFT_TYPE_SOCKET,
"hostname", "localhost",
"port", TEST_PORT, NULL);
protocol = (ThriftBinaryProtocol *) g_object_new (THRIFT_TYPE_BINARY_PROTOCOL,
@@ -607,11 +618,11 @@ main (void)
if (pid == 0) /* child */
{
boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
boost::shared_ptr<TestHandler> testHandler(new TestHandler());
boost::shared_ptr<ThriftTestProcessor> testProcessor(new ThriftTestProcessor(testHandler));
boost::shared_ptr<TServerSocket> serverSocket(new TServerSocket(TEST_PORT));
boost::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
stdcxx::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
stdcxx::shared_ptr<TestHandler> testHandler(new TestHandler());
stdcxx::shared_ptr<ThriftTestProcessor> testProcessor(new ThriftTestProcessor(testHandler));
stdcxx::shared_ptr<TServerSocket> serverSocket(new TServerSocket(TEST_PORT));
stdcxx::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
TSimpleServer simpleServer(testProcessor, serverSocket, transportFactory, protocolFactory);
signal (SIGALRM, bailout);
alarm (60);

View File

@@ -138,6 +138,8 @@ endif()
# Thrift non blocking server
set( thriftcppnb_SOURCES
src/thrift/server/TNonblockingServer.cpp
src/thrift/transport/TNonblockingServerSocket.cpp
src/thrift/transport/TNonblockingSSLServerSocket.cpp
src/thrift/async/TAsyncProtocolProcessor.cpp
src/thrift/async/TEvhttpServer.cpp
src/thrift/async/TEvhttpClientChannel.cpp

View File

@@ -94,6 +94,8 @@ libthrift_la_SOURCES = src/thrift/TApplicationException.cpp \
src/thrift/transport/TSocketPool.cpp \
src/thrift/transport/TServerSocket.cpp \
src/thrift/transport/TSSLServerSocket.cpp \
src/thrift/transport/TNonblockingServerSocket.cpp \
src/thrift/transport/TNonblockingSSLServerSocket.cpp \
src/thrift/transport/TTransportUtils.cpp \
src/thrift/transport/TBufferTransports.cpp \
src/thrift/server/TConnectedClient.cpp \
@@ -120,7 +122,7 @@ libthriftnb_la_SOURCES = src/thrift/server/TNonblockingServer.cpp \
libthriftz_la_SOURCES = src/thrift/transport/TZlibTransport.cpp \
src/thrift/transport/THeaderTransport.cpp \
src/thrift/protocol/THeaderProtocol.cpp
src/thrift/protocol/THeaderProtocol.cpp
libthriftqt_la_MOC = src/thrift/qt/moc_TQTcpServer.cpp
@@ -162,8 +164,8 @@ include_thrift_HEADERS = \
src/thrift/TProcessor.h \
src/thrift/TApplicationException.h \
src/thrift/TLogging.h \
src/thrift/cxxfunctional.h \
src/thrift/TToString.h \
src/thrift/stdcxx.h \
src/thrift/TBase.h
include_concurrencydir = $(include_thriftdir)/concurrency
@@ -212,6 +214,9 @@ include_transport_HEADERS = \
src/thrift/transport/TServerSocket.h \
src/thrift/transport/TSSLServerSocket.h \
src/thrift/transport/TServerTransport.h \
src/thrift/transport/TNonblockingServerTransport.h \
src/thrift/transport/TNonblockingServerSocket.h \
src/thrift/transport/TNonblockingSSLServerSocket.h \
src/thrift/transport/THttpTransport.h \
src/thrift/transport/THttpClient.h \
src/thrift/transport/THttpServer.h \

View File

@@ -19,7 +19,6 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
# Using Thrift with C++
The Thrift C++ libraries are built using the GNU tools. Follow the instructions
@@ -55,15 +54,22 @@ you are using libthriftnb you will also need libevent.
## Dependencies
boost shared pointers
http://www.boost.org/libs/smart_ptr/smart_ptr.htm
If your C++ environment implements C++11 or later, thrift will automatically use
std::shared_ptr. Otherwise you will need the boost library to provide a shared_ptr
implementation for C++ environments pre-C++11. If you are linking against code
that expects to be using boost::shared_ptr, you can define the preprocessor
variable FORCE_BOOST_SMART_PTR for your build of thrift to make it use boost instead
of std for a number of memory related classes. See thrift/stdcxx.h for more.
libevent (for libthriftnb only)
http://monkey.org/~provos/libevent/
# Using Thrift with C++ on Windows
You need to define an environment variables for 3rd party components separately:
Both the autoconf and cmake build systems are able to automatically detect many
system configurations without the need to specify library locations, however if
you run into problems or want to redirect thrift to build and link against your
own provided third party libraries:
BOOST_ROOT : For boost, e.g. D:\boost_1_55_0
OPENSSL_ROOT_DIR : For OpenSSL, e.g. D:\OpenSSL-Win32
@@ -74,13 +80,7 @@ LIBEVENT_ROOT_DIR : For Libevent e.g. D:\libevent-2.0.21-stable
See /3rdparty.user for more details.
Thrift is divided into two libraries.
* libthrift - The core Thrift library contains all the core Thrift code. It requires
boost shared pointers, pthreads, and librt.
* libthriftnb - This library contains the Thrift nonblocking server, which uses libevent.
To link this library you will also need to link libevent.
The same linking guidelines described above for libthriftnb apply to windows as well.
## Linking Against Thrift
@@ -93,8 +93,7 @@ the config header: "windows/confg.h"
## Dependencies
boost shared pointers
http://www.boost.org/libs/smart_ptr/smart_ptr.htm
The same dependencies for shared_ptr as described above apply to windows as well.
boost thread
http://www.boost.org/doc/libs/release/doc/html/thread.html
@@ -277,6 +276,12 @@ overridden if it's not strong enough for you.
## 0.11.0
Older versions of thrift depended on the <boost/smart_ptr.hpp> classes which
were used in thrift headers to define interfaces. Thrift now detects C++11
at build time and will prefer to use <memory> classes from C++11 instead.
You can force the library to build with boost memory classes by defining the
preprocessor macro `FORCE_BOOST_SMART_PTR`. (THRIFT-2221)
In the pthread mutex implementation, the contention profiling code was enabled
by default in all builds. This changed to be disabled by default. (THRIFT-4151)

View File

@@ -35,16 +35,21 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\thrift\async\TAsyncProtocolProcessor.cpp"/>
<ClCompile Include="src\thrift\async\TEvhttpClientChannel.cpp"/>
<ClCompile Include="src\thrift\async\TEvhttpServer.cpp"/>
<ClCompile Include="src\thrift\server\TNonblockingServer.cpp"/>
<ClCompile Include="src\thrift\async\TAsyncProtocolProcessor.cpp" />
<ClCompile Include="src\thrift\async\TEvhttpClientChannel.cpp" />
<ClCompile Include="src\thrift\async\TEvhttpServer.cpp" />
<ClCompile Include="src\thrift\server\TNonblockingServer.cpp" />
<ClCompile Include="src\thrift\transport\TNonblockingServerSocket.cpp" />
<ClCompile Include="src\thrift\transport\TNonblockingSSLServerSocket.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\thrift\async\TAsyncProtocolProcessor.h" />
<ClInclude Include="src\thrift\async\TEvhttpClientChannel.h" />
<ClInclude Include="src\thrift\async\TEvhttpServer.h" />
<ClInclude Include="src\thrift\server\TNonblockingServer.h" />
<ClInclude Include="src\thrift\transport\TNonblockingServerSocket.h" />
<ClInclude Include="src\thrift\transport\TNonblockingServerTransport.h" />
<ClInclude Include="src\thrift\transport\TNonblockingSSLServerSocket.h" />
<ClInclude Include="src\thrift\windows\config.h" />
<ClInclude Include="src\thrift\windows\force_inc.h" />
<ClInclude Include="src\thrift\windows\TargetVersion.h" />
@@ -290,4 +295,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@@ -10,6 +10,9 @@
<Filter Include="windows">
<UniqueIdentifier>{60fc9e5e-0866-4aba-8662-439bb4a461d3}</UniqueIdentifier>
</Filter>
<Filter Include="transport">
<UniqueIdentifier>{23fe2fde-a7c9-43ec-a409-7f53df5eee64}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\thrift\server\TNonblockingServer.cpp">
@@ -27,6 +30,12 @@
<ClCompile Include="src\thrift\windows\StdAfx.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="src\thrift\transport\TNonblockingServerSocket.cpp">
<Filter>transport</Filter>
</ClCompile>
<ClCompile Include="src\thrift\transport\TNonblockingSSLServerSocket.cpp">
<Filter>transport</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\thrift\server\TNonblockingServer.h">
@@ -53,5 +62,14 @@
<ClInclude Include="src\thrift\windows\force_inc.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="src\thrift\transport\TNonblockingServerSocket.h">
<Filter>transport</Filter>
</ClInclude>
<ClInclude Include="src\thrift\transport\TNonblockingServerTransport.h">
<Filter>transport</Filter>
</ClInclude>
<ClInclude Include="src\thrift\transport\TNonblockingSSLServerSocket.h">
<Filter>transport</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>

View File

@@ -33,8 +33,8 @@ namespace thrift {
template <class Protocol_>
class TDispatchProcessorT : public TProcessor {
public:
virtual bool process(boost::shared_ptr<protocol::TProtocol> in,
boost::shared_ptr<protocol::TProtocol> out,
virtual bool process(stdcxx::shared_ptr<protocol::TProtocol> in,
stdcxx::shared_ptr<protocol::TProtocol> out,
void* connectionContext) {
protocol::TProtocol* inRaw = in.get();
protocol::TProtocol* outRaw = out.get();
@@ -105,8 +105,8 @@ protected:
*/
class TDispatchProcessor : public TProcessor {
public:
virtual bool process(boost::shared_ptr<protocol::TProtocol> in,
boost::shared_ptr<protocol::TProtocol> out,
virtual bool process(stdcxx::shared_ptr<protocol::TProtocol> in,
stdcxx::shared_ptr<protocol::TProtocol> out,
void* connectionContext) {
std::string fname;
protocol::TMessageType mtype;

View File

@@ -22,7 +22,7 @@
#include <string>
#include <thrift/protocol/TProtocol.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -142,28 +142,28 @@ class TProcessor {
public:
virtual ~TProcessor() {}
virtual bool process(boost::shared_ptr<protocol::TProtocol> in,
boost::shared_ptr<protocol::TProtocol> out,
virtual bool process(stdcxx::shared_ptr<protocol::TProtocol> in,
stdcxx::shared_ptr<protocol::TProtocol> out,
void* connectionContext) = 0;
bool process(boost::shared_ptr<apache::thrift::protocol::TProtocol> io, void* connectionContext) {
bool process(stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> io, void* connectionContext) {
return process(io, io, connectionContext);
}
boost::shared_ptr<TProcessorEventHandler> getEventHandler() const { return eventHandler_; }
stdcxx::shared_ptr<TProcessorEventHandler> getEventHandler() const { return eventHandler_; }
void setEventHandler(boost::shared_ptr<TProcessorEventHandler> eventHandler) {
void setEventHandler(stdcxx::shared_ptr<TProcessorEventHandler> eventHandler) {
eventHandler_ = eventHandler;
}
protected:
TProcessor() {}
boost::shared_ptr<TProcessorEventHandler> eventHandler_;
stdcxx::shared_ptr<TProcessorEventHandler> eventHandler_;
};
/**
* This is a helper class to allow boost::shared_ptr to be used with handler
* This is a helper class to allow stdcxx::shared_ptr to be used with handler
* pointers returned by the generated handler factories.
*
* The handler factory classes generated by the thrift compiler return raw
@@ -177,7 +177,7 @@ protected:
template <typename HandlerFactory_>
class ReleaseHandler {
public:
ReleaseHandler(const boost::shared_ptr<HandlerFactory_>& handlerFactory)
ReleaseHandler(const stdcxx::shared_ptr<HandlerFactory_>& handlerFactory)
: handlerFactory_(handlerFactory) {}
void operator()(typename HandlerFactory_::Handler* handler) {
@@ -187,18 +187,18 @@ public:
}
private:
boost::shared_ptr<HandlerFactory_> handlerFactory_;
stdcxx::shared_ptr<HandlerFactory_> handlerFactory_;
};
struct TConnectionInfo {
// The input and output protocols
boost::shared_ptr<protocol::TProtocol> input;
boost::shared_ptr<protocol::TProtocol> output;
stdcxx::shared_ptr<protocol::TProtocol> input;
stdcxx::shared_ptr<protocol::TProtocol> output;
// The underlying transport used for the connection
// This is the transport that was returned by TServerTransport::accept(),
// and it may be different than the transport pointed to by the input and
// output protocols.
boost::shared_ptr<transport::TTransport> transport;
stdcxx::shared_ptr<transport::TTransport> transport;
};
class TProcessorFactory {
@@ -212,17 +212,17 @@ public:
* accepted on. This generally means that this call does not need to be
* thread safe, as it will always be invoked from a single thread.
*/
virtual boost::shared_ptr<TProcessor> getProcessor(const TConnectionInfo& connInfo) = 0;
virtual stdcxx::shared_ptr<TProcessor> getProcessor(const TConnectionInfo& connInfo) = 0;
};
class TSingletonProcessorFactory : public TProcessorFactory {
public:
TSingletonProcessorFactory(boost::shared_ptr<TProcessor> processor) : processor_(processor) {}
TSingletonProcessorFactory(stdcxx::shared_ptr<TProcessor> processor) : processor_(processor) {}
boost::shared_ptr<TProcessor> getProcessor(const TConnectionInfo&) { return processor_; }
stdcxx::shared_ptr<TProcessor> getProcessor(const TConnectionInfo&) { return processor_; }
private:
boost::shared_ptr<TProcessor> processor_;
stdcxx::shared_ptr<TProcessor> processor_;
};
}
} // apache::thrift

View File

@@ -20,9 +20,7 @@
#ifndef _THRIFT_TASYNC_BUFFER_PROCESSOR_H_
#define _THRIFT_TASYNC_BUFFER_PROCESSOR_H_ 1
#include <thrift/cxxfunctional.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <thrift/transport/TBufferTransports.h>
namespace apache {
@@ -36,9 +34,9 @@ public:
// forcefully close the connection (if applicable).
// "in" and "out" should be TMemoryBuffer or similar,
// not a wrapper around a socket.
virtual void process(apache::thrift::stdcxx::function<void(bool healthy)> _return,
boost::shared_ptr<apache::thrift::transport::TBufferBase> ibuf,
boost::shared_ptr<apache::thrift::transport::TBufferBase> obuf) = 0;
virtual void process(stdcxx::function<void(bool healthy)> _return,
stdcxx::shared_ptr<transport::TBufferBase> ibuf,
stdcxx::shared_ptr<transport::TBufferBase> obuf) = 0;
virtual ~TAsyncBufferProcessor() {}
};
}

View File

@@ -18,7 +18,7 @@
*/
#include <thrift/async/TAsyncChannel.h>
#include <thrift/cxxfunctional.h>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {

View File

@@ -20,7 +20,7 @@
#ifndef _THRIFT_ASYNC_TASYNCCHANNEL_H_
#define _THRIFT_ASYNC_TASYNCCHANNEL_H_ 1
#include <thrift/cxxfunctional.h>
#include <thrift/stdcxx.h>
#include <thrift/Thrift.h>
namespace apache {

View File

@@ -35,8 +35,8 @@ template <class Protocol_>
class TAsyncDispatchProcessorT : public TAsyncProcessor {
public:
virtual void process(apache::thrift::stdcxx::function<void(bool success)> _return,
boost::shared_ptr<protocol::TProtocol> in,
boost::shared_ptr<protocol::TProtocol> out) {
stdcxx::shared_ptr<protocol::TProtocol> in,
stdcxx::shared_ptr<protocol::TProtocol> out) {
protocol::TProtocol* inRaw = in.get();
protocol::TProtocol* outRaw = out.get();
@@ -107,8 +107,8 @@ public:
class TAsyncDispatchProcessor : public TAsyncProcessor {
public:
virtual void process(apache::thrift::stdcxx::function<void(bool success)> _return,
boost::shared_ptr<protocol::TProtocol> in,
boost::shared_ptr<protocol::TProtocol> out) {
stdcxx::shared_ptr<protocol::TProtocol> in,
stdcxx::shared_ptr<protocol::TProtocol> out) {
protocol::TProtocol* inRaw = in.get();
protocol::TProtocol* outRaw = out.get();

View File

@@ -20,9 +20,8 @@
#ifndef _THRIFT_TASYNCPROCESSOR_H_
#define _THRIFT_TASYNCPROCESSOR_H_ 1
#include <thrift/cxxfunctional.h>
#include <boost/shared_ptr.hpp>
#include <thrift/protocol/TProtocol.h>
#include <thrift/stdcxx.h>
#include <thrift/TProcessor.h>
namespace apache {
@@ -38,25 +37,25 @@ class TAsyncProcessor {
public:
virtual ~TAsyncProcessor() {}
virtual void process(apache::thrift::stdcxx::function<void(bool success)> _return,
boost::shared_ptr<protocol::TProtocol> in,
boost::shared_ptr<protocol::TProtocol> out) = 0;
virtual void process(stdcxx::function<void(bool success)> _return,
stdcxx::shared_ptr<protocol::TProtocol> in,
stdcxx::shared_ptr<protocol::TProtocol> out) = 0;
void process(apache::thrift::stdcxx::function<void(bool success)> _return,
boost::shared_ptr<apache::thrift::protocol::TProtocol> io) {
void process(stdcxx::function<void(bool success)> _return,
stdcxx::shared_ptr<protocol::TProtocol> io) {
return process(_return, io, io);
}
boost::shared_ptr<TProcessorEventHandler> getEventHandler() const { return eventHandler_; }
stdcxx::shared_ptr<TProcessorEventHandler> getEventHandler() const { return eventHandler_; }
void setEventHandler(boost::shared_ptr<TProcessorEventHandler> eventHandler) {
void setEventHandler(stdcxx::shared_ptr<TProcessorEventHandler> eventHandler) {
eventHandler_ = eventHandler;
}
protected:
TAsyncProcessor() {}
boost::shared_ptr<TProcessorEventHandler> eventHandler_;
stdcxx::shared_ptr<TProcessorEventHandler> eventHandler_;
};
class TAsyncProcessorFactory {
@@ -70,16 +69,15 @@ public:
* accepted on. This generally means that this call does not need to be
* thread safe, as it will always be invoked from a single thread.
*/
virtual boost::shared_ptr<TAsyncProcessor> getProcessor(const TConnectionInfo& connInfo) = 0;
virtual stdcxx::shared_ptr<TAsyncProcessor> getProcessor(const TConnectionInfo& connInfo) = 0;
};
}
}
} // apache::thrift::async
// XXX I'm lazy for now
namespace apache {
namespace thrift {
using apache::thrift::async::TAsyncProcessor;
using apache::thrift::async::TAsyncProcessor;
}
}

View File

@@ -27,10 +27,10 @@ namespace thrift {
namespace async {
void TAsyncProtocolProcessor::process(apache::thrift::stdcxx::function<void(bool healthy)> _return,
boost::shared_ptr<TBufferBase> ibuf,
boost::shared_ptr<TBufferBase> obuf) {
boost::shared_ptr<TProtocol> iprot(pfact_->getProtocol(ibuf));
boost::shared_ptr<TProtocol> oprot(pfact_->getProtocol(obuf));
stdcxx::shared_ptr<TBufferBase> ibuf,
stdcxx::shared_ptr<TBufferBase> obuf) {
stdcxx::shared_ptr<TProtocol> iprot(pfact_->getProtocol(ibuf));
stdcxx::shared_ptr<TProtocol> oprot(pfact_->getProtocol(obuf));
return underlying_
->process(apache::thrift::stdcxx::bind(&TAsyncProtocolProcessor::finish,
_return,
@@ -42,7 +42,7 @@ void TAsyncProtocolProcessor::process(apache::thrift::stdcxx::function<void(bool
/* static */ void TAsyncProtocolProcessor::finish(
apache::thrift::stdcxx::function<void(bool healthy)> _return,
boost::shared_ptr<TProtocol> oprot,
stdcxx::shared_ptr<TProtocol> oprot,
bool healthy) {
(void)oprot;
// This is a stub function to hold a reference to oprot.

View File

@@ -30,23 +30,23 @@ namespace async {
class TAsyncProtocolProcessor : public TAsyncBufferProcessor {
public:
TAsyncProtocolProcessor(boost::shared_ptr<TAsyncProcessor> underlying,
boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> pfact)
TAsyncProtocolProcessor(stdcxx::shared_ptr<TAsyncProcessor> underlying,
stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory> pfact)
: underlying_(underlying), pfact_(pfact) {}
virtual void process(apache::thrift::stdcxx::function<void(bool healthy)> _return,
boost::shared_ptr<apache::thrift::transport::TBufferBase> ibuf,
boost::shared_ptr<apache::thrift::transport::TBufferBase> obuf);
stdcxx::shared_ptr<apache::thrift::transport::TBufferBase> ibuf,
stdcxx::shared_ptr<apache::thrift::transport::TBufferBase> obuf);
virtual ~TAsyncProtocolProcessor() {}
private:
static void finish(apache::thrift::stdcxx::function<void(bool healthy)> _return,
boost::shared_ptr<apache::thrift::protocol::TProtocol> oprot,
stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> oprot,
bool healthy);
boost::shared_ptr<TAsyncProcessor> underlying_;
boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> pfact_;
stdcxx::shared_ptr<TAsyncProcessor> underlying_;
stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory> pfact_;
};
}
}

View File

@@ -22,7 +22,7 @@
#include <thrift/protocol/TProtocol.h>
#include <thrift/concurrency/Mutex.h>
#include <thrift/concurrency/Monitor.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <vector>
#include <string>
#include <map>
@@ -60,7 +60,7 @@ private:
class TConcurrentClientSyncInfo {
private: // typedefs
typedef boost::shared_ptr< ::apache::thrift::concurrency::Monitor> MonitorPtr;
typedef stdcxx::shared_ptr< ::apache::thrift::concurrency::Monitor> MonitorPtr;
typedef std::map<int32_t, MonitorPtr> MonitorMap;
public:

View File

@@ -23,7 +23,7 @@
#include <queue>
#include <string>
#include <utility>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <thrift/async/TAsyncChannel.h>
struct event_base;

View File

@@ -20,7 +20,7 @@
#include <thrift/async/TEvhttpServer.h>
#include <thrift/async/TAsyncBufferProcessor.h>
#include <thrift/transport/TBufferTransports.h>
#include <boost/scoped_ptr.hpp>
#include <thrift/stdcxx.h>
#include <evhttp.h>
#include <event2/buffer.h>
#include <event2/buffer_compat.h>
@@ -31,6 +31,8 @@
#endif
using apache::thrift::transport::TMemoryBuffer;
using apache::thrift::stdcxx::scoped_ptr;
using apache::thrift::stdcxx::shared_ptr;
namespace apache {
namespace thrift {
@@ -38,17 +40,17 @@ namespace async {
struct TEvhttpServer::RequestContext {
struct evhttp_request* req;
boost::shared_ptr<apache::thrift::transport::TMemoryBuffer> ibuf;
boost::shared_ptr<apache::thrift::transport::TMemoryBuffer> obuf;
stdcxx::shared_ptr<apache::thrift::transport::TMemoryBuffer> ibuf;
stdcxx::shared_ptr<apache::thrift::transport::TMemoryBuffer> obuf;
RequestContext(struct evhttp_request* req);
};
TEvhttpServer::TEvhttpServer(boost::shared_ptr<TAsyncBufferProcessor> processor)
TEvhttpServer::TEvhttpServer(stdcxx::shared_ptr<TAsyncBufferProcessor> processor)
: processor_(processor), eb_(NULL), eh_(NULL) {
}
TEvhttpServer::TEvhttpServer(boost::shared_ptr<TAsyncBufferProcessor> processor, int port)
TEvhttpServer::TEvhttpServer(stdcxx::shared_ptr<TAsyncBufferProcessor> processor, int port)
: processor_(processor), eb_(NULL), eh_(NULL) {
// Create event_base and evhttp.
eb_ = event_base_new();
@@ -118,7 +120,7 @@ void TEvhttpServer::process(struct evhttp_request* req) {
void TEvhttpServer::complete(RequestContext* ctx, bool success) {
(void)success;
boost::scoped_ptr<RequestContext> ptr(ctx);
scoped_ptr<RequestContext> ptr(ctx);
int code = success ? 200 : 400;
const char* reason = success ? "OK" : "Bad Request";

View File

@@ -20,7 +20,7 @@
#ifndef _THRIFT_TEVHTTP_SERVER_H_
#define _THRIFT_TEVHTTP_SERVER_H_ 1
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
struct event_base;
struct evhttp;
@@ -41,14 +41,14 @@ public:
* address of the server as the extra arg.
* Do not call "serve" on this server.
*/
TEvhttpServer(boost::shared_ptr<TAsyncBufferProcessor> processor);
TEvhttpServer(stdcxx::shared_ptr<TAsyncBufferProcessor> processor);
/**
* Create a TEvhttpServer with an embedded event_base and evhttp,
* listening on port and responding on the endpoint "/".
* Call "serve" on this server to serve forever.
*/
TEvhttpServer(boost::shared_ptr<TAsyncBufferProcessor> processor, int port);
TEvhttpServer(stdcxx::shared_ptr<TAsyncBufferProcessor> processor, int port);
~TEvhttpServer();
@@ -63,7 +63,7 @@ private:
void process(struct evhttp_request* req);
void complete(RequestContext* ctx, bool success);
boost::shared_ptr<TAsyncBufferProcessor> processor_;
stdcxx::shared_ptr<TAsyncBufferProcessor> processor_;
struct event_base* eb_;
struct evhttp* eh_;
};

View File

@@ -23,9 +23,9 @@
#include <thrift/concurrency/Exception.h>
#include <thrift/concurrency/Util.h>
#include <thrift/transport/PlatformSocket.h>
#include <assert.h>
#include <thrift/stdcxx.h>
#include <boost/scoped_ptr.hpp>
#include <assert.h>
#include <boost/thread.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
@@ -155,7 +155,7 @@ public:
private:
void init(Mutex* mutex) { mutex_ = mutex; }
boost::scoped_ptr<Mutex> ownedMutex_;
stdcxx::scoped_ptr<Mutex> ownedMutex_;
Mutex* mutex_;
};

View File

@@ -23,19 +23,20 @@
#include <thrift/concurrency/BoostThreadFactory.h>
#include <thrift/concurrency/Exception.h>
#include <thrift/stdcxx.h>
#include <cassert>
#include <boost/scoped_ptr.hpp>
#include <boost/thread.hpp>
#include <boost/weak_ptr.hpp>
namespace apache {
namespace thrift {
namespace concurrency {
using boost::shared_ptr;
using boost::weak_ptr;
using stdcxx::bind;
using stdcxx::scoped_ptr;
using stdcxx::shared_ptr;
using stdcxx::weak_ptr;
namespace concurrency {
/**
* The boost thread class.
@@ -49,7 +50,7 @@ public:
static void* threadMain(void* arg);
private:
boost::scoped_ptr<boost::thread> thread_;
scoped_ptr<boost::thread> thread_;
STATE state_;
weak_ptr<BoostThread> self_;
bool detached_;
@@ -81,7 +82,7 @@ public:
state_ = starting;
thread_.reset(new boost::thread(boost::bind(threadMain, (void*)selfRef)));
thread_.reset(new boost::thread(bind(threadMain, (void*)selfRef)));
if (detached_)
thread_->detach();

View File

@@ -22,7 +22,7 @@
#include <thrift/concurrency/Thread.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -38,9 +38,8 @@ class BoostThreadFactory : public ThreadFactory {
public:
/**
* Boost thread factory. All threads created by a factory are reference-counted
* via boost::shared_ptr and boost::weak_ptr. The factory guarantees that threads and
* the Runnable tasks they host will be properly cleaned up once the last strong reference
* to both is given up.
* via stdcxx::shared_ptr. The factory guarantees that threads and the Runnable tasks they
* host will be properly cleaned up once the last strong reference to both is given up.
*
* Threads are created with the specified boost policy, priority, stack-size. A detachable thread
* is not joinable.
@@ -51,7 +50,7 @@ public:
BoostThreadFactory(bool detached = true);
// From ThreadFactory;
boost::shared_ptr<Thread> newThread(boost::shared_ptr<Runnable> runnable) const;
stdcxx::shared_ptr<Thread> newThread(stdcxx::shared_ptr<Runnable> runnable) const;
// From ThreadFactory;
Thread::id_t getCurrentThreadId() const;

View File

@@ -20,8 +20,8 @@
#ifndef _THRIFT_CONCURRENCY_FUNCTION_RUNNER_H
#define _THRIFT_CONCURRENCY_FUNCTION_RUNNER_H 1
#include <thrift/cxxfunctional.h>
#include <thrift/concurrency/Thread.h>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -53,20 +53,20 @@ public:
// This is the type of callback 'pthread_create()' expects.
typedef void* (*PthreadFuncPtr)(void* arg);
// This a fully-generic void(void) callback for custom bindings.
typedef apache::thrift::stdcxx::function<void()> VoidFunc;
typedef stdcxx::function<void()> VoidFunc;
typedef apache::thrift::stdcxx::function<bool()> BoolFunc;
typedef stdcxx::function<bool()> BoolFunc;
/**
* Syntactic sugar to make it easier to create new FunctionRunner
* objects wrapped in shared_ptr.
*/
static boost::shared_ptr<FunctionRunner> create(const VoidFunc& cob) {
return boost::shared_ptr<FunctionRunner>(new FunctionRunner(cob));
static stdcxx::shared_ptr<FunctionRunner> create(const VoidFunc& cob) {
return stdcxx::shared_ptr<FunctionRunner>(new FunctionRunner(cob));
}
static boost::shared_ptr<FunctionRunner> create(PthreadFuncPtr func, void* arg) {
return boost::shared_ptr<FunctionRunner>(new FunctionRunner(func, arg));
static stdcxx::shared_ptr<FunctionRunner> create(PthreadFuncPtr func, void* arg) {
return stdcxx::shared_ptr<FunctionRunner>(new FunctionRunner(func, arg));
}
private:
@@ -81,7 +81,7 @@ public:
* execute the given callback. Note that the 'void*' return value is ignored.
*/
FunctionRunner(PthreadFuncPtr func, void* arg)
: func_(apache::thrift::stdcxx::bind(pthread_func_wrapper, func, arg)), intervalMs_(-1) {}
: func_(stdcxx::bind(pthread_func_wrapper, func, arg)), intervalMs_(-1) {}
/**
* Given a generic callback, this FunctionRunner will execute it.

View File

@@ -23,8 +23,7 @@
#include <thrift/concurrency/Exception.h>
#include <thrift/concurrency/Util.h>
#include <thrift/transport/PlatformSocket.h>
#include <boost/scoped_ptr.hpp>
#include <thrift/stdcxx.h>
#include <assert.h>
@@ -34,9 +33,11 @@
namespace apache {
namespace thrift {
namespace concurrency {
using boost::scoped_ptr;
using stdcxx::scoped_ptr;
using stdcxx::shared_ptr;
namespace concurrency {
/**
* Monitor implementation using the POSIX pthread library

View File

@@ -34,8 +34,6 @@
#include <string.h>
#include <boost/format.hpp>
#include <boost/shared_ptr.hpp>
using boost::shared_ptr;
namespace apache {
namespace thrift {

View File

@@ -20,7 +20,7 @@
#ifndef _THRIFT_CONCURRENCY_MUTEX_H_
#define _THRIFT_CONCURRENCY_MUTEX_H_ 1
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <boost/noncopyable.hpp>
#include <stdint.h>
@@ -86,7 +86,7 @@ public:
private:
class impl;
boost::shared_ptr<impl> impl_;
stdcxx::shared_ptr<impl> impl_;
};
class ReadWriteMutex {
@@ -107,7 +107,7 @@ public:
private:
class impl;
boost::shared_ptr<impl> impl_;
stdcxx::shared_ptr<impl> impl_;
};
/**

View File

@@ -19,8 +19,9 @@
#include <thrift/thrift-config.h>
#include <thrift/concurrency/PosixThreadFactory.h>
#include <thrift/concurrency/Exception.h>
#include <thrift/concurrency/Mutex.h>
#include <thrift/concurrency/PosixThreadFactory.h>
#if GOOGLE_PERFTOOLS_REGISTER_THREAD
#include <google/profiler.h>
@@ -31,15 +32,12 @@
#include <iostream>
#include <boost/weak_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
namespace concurrency {
using boost::shared_ptr;
using boost::weak_ptr;
/**
* The POSIX thread class.
*
@@ -55,11 +53,12 @@ public:
private:
pthread_t pthread_;
Mutex state_mutex_;
STATE state_;
int policy_;
int priority_;
int stackSize_;
weak_ptr<PthreadThread> self_;
stdcxx::weak_ptr<PthreadThread> self_;
bool detached_;
public:
@@ -67,13 +66,12 @@ public:
int priority,
int stackSize,
bool detached,
shared_ptr<Runnable> runnable)
stdcxx::shared_ptr<Runnable> runnable)
:
#ifndef _WIN32
pthread_(0),
#endif // _WIN32
state_(uninitialized),
policy_(policy),
priority_(priority),
@@ -96,8 +94,20 @@ public:
}
}
STATE getState() const
{
Guard g(state_mutex_);
return state_;
}
void setState(STATE newState)
{
Guard g(state_mutex_);
state_ = newState;
}
void start() {
if (state_ != uninitialized) {
if (getState() != uninitialized) {
return;
}
@@ -139,10 +149,10 @@ public:
}
// Create reference
shared_ptr<PthreadThread>* selfRef = new shared_ptr<PthreadThread>();
stdcxx::shared_ptr<PthreadThread>* selfRef = new stdcxx::shared_ptr<PthreadThread>();
*selfRef = self_.lock();
state_ = starting;
setState(starting);
if (pthread_create(&pthread_, &thread_attr, threadMain, (void*)selfRef) != 0) {
throw SystemResourceException("pthread_create failed");
@@ -150,7 +160,7 @@ public:
}
void join() {
if (!detached_ && state_ != uninitialized) {
if (!detached_ && getState() != uninitialized) {
void* ignore;
/* XXX
If join fails it is most likely due to the fact
@@ -178,25 +188,25 @@ public:
#endif // _WIN32
}
shared_ptr<Runnable> runnable() const { return Thread::runnable(); }
stdcxx::shared_ptr<Runnable> runnable() const { return Thread::runnable(); }
void runnable(shared_ptr<Runnable> value) { Thread::runnable(value); }
void runnable(stdcxx::shared_ptr<Runnable> value) { Thread::runnable(value); }
void weakRef(shared_ptr<PthreadThread> self) {
void weakRef(stdcxx::shared_ptr<PthreadThread> self) {
assert(self.get() == this);
self_ = weak_ptr<PthreadThread>(self);
self_ = stdcxx::weak_ptr<PthreadThread>(self);
}
};
void* PthreadThread::threadMain(void* arg) {
shared_ptr<PthreadThread> thread = *(shared_ptr<PthreadThread>*)arg;
delete reinterpret_cast<shared_ptr<PthreadThread>*>(arg);
stdcxx::shared_ptr<PthreadThread> thread = *(stdcxx::shared_ptr<PthreadThread>*)arg;
delete reinterpret_cast<stdcxx::shared_ptr<PthreadThread>*>(arg);
if (thread == NULL) {
return (void*)0;
}
if (thread->state_ != starting) {
if (thread->getState() != starting) {
return (void*)0;
}
@@ -204,10 +214,13 @@ void* PthreadThread::threadMain(void* arg) {
ProfilerRegisterThread();
#endif
thread->state_ = started;
thread->setState(started);
thread->runnable()->run();
if (thread->state_ != stopping && thread->state_ != stopped) {
thread->state_ = stopping;
STATE _s = thread->getState();
if (_s != stopping && _s != stopped) {
thread->setState(stopping);
}
return (void*)0;
@@ -276,9 +289,9 @@ PosixThreadFactory::PosixThreadFactory(bool detached)
stackSize_(1) {
}
shared_ptr<Thread> PosixThreadFactory::newThread(shared_ptr<Runnable> runnable) const {
shared_ptr<PthreadThread> result
= shared_ptr<PthreadThread>(new PthreadThread(toPthreadPolicy(policy_),
stdcxx::shared_ptr<Thread> PosixThreadFactory::newThread(stdcxx::shared_ptr<Runnable> runnable) const {
stdcxx::shared_ptr<PthreadThread> result
= stdcxx::shared_ptr<PthreadThread>(new PthreadThread(toPthreadPolicy(policy_),
toPthreadPriority(policy_, priority_),
stackSize_,
isDetached(),

View File

@@ -22,7 +22,7 @@
#include <thrift/concurrency/Thread.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -63,9 +63,9 @@ public:
/**
* Posix thread (pthread) factory. All threads created by a factory are reference-counted
* via boost::shared_ptr and boost::weak_ptr. The factory guarantees that threads and
* the Runnable tasks they host will be properly cleaned up once the last strong reference
* to both is given up.
* via stdcxx::shared_ptr. The factory guarantees that threads and the Runnable tasks
* they host will be properly cleaned up once the last strong reference to both is
* given up.
*
* Threads are created with the specified policy, priority, stack-size and detachable-mode
* detached means the thread is free-running and will release all system resources the
@@ -88,7 +88,7 @@ public:
PosixThreadFactory(bool detached);
// From ThreadFactory;
boost::shared_ptr<Thread> newThread(boost::shared_ptr<Runnable> runnable) const;
stdcxx::shared_ptr<Thread> newThread(stdcxx::shared_ptr<Runnable> runnable) const;
// From ThreadFactory;
Thread::id_t getCurrentThreadId() const;

View File

@@ -23,11 +23,9 @@
#include <thrift/concurrency/StdThreadFactory.h>
#include <thrift/concurrency/Exception.h>
#include <thrift/stdcxx.h>
#include <cassert>
#include <boost/enable_shared_from_this.hpp>
#include <boost/weak_ptr.hpp>
#include <thread>
namespace apache {
@@ -43,11 +41,11 @@ namespace concurrency {
*
* @version $Id:$
*/
class StdThread : public Thread, public boost::enable_shared_from_this<StdThread> {
class StdThread : public Thread, public stdcxx::enable_shared_from_this<StdThread> {
public:
enum STATE { uninitialized, starting, started, stopping, stopped };
static void threadMain(boost::shared_ptr<StdThread> thread);
static void threadMain(stdcxx::shared_ptr<StdThread> thread);
private:
std::unique_ptr<std::thread> thread_;
@@ -55,7 +53,7 @@ private:
bool detached_;
public:
StdThread(bool detached, boost::shared_ptr<Runnable> runnable)
StdThread(bool detached, stdcxx::shared_ptr<Runnable> runnable)
: state_(uninitialized), detached_(detached) {
this->Thread::runnable(runnable);
}
@@ -75,7 +73,7 @@ public:
return;
}
boost::shared_ptr<StdThread> selfRef = shared_from_this();
stdcxx::shared_ptr<StdThread> selfRef = shared_from_this();
state_ = starting;
thread_ = std::unique_ptr<std::thread>(new std::thread(threadMain, selfRef));
@@ -92,12 +90,12 @@ public:
Thread::id_t getId() { return thread_.get() ? thread_->get_id() : std::thread::id(); }
boost::shared_ptr<Runnable> runnable() const { return Thread::runnable(); }
stdcxx::shared_ptr<Runnable> runnable() const { return Thread::runnable(); }
void runnable(boost::shared_ptr<Runnable> value) { Thread::runnable(value); }
void runnable(stdcxx::shared_ptr<Runnable> value) { Thread::runnable(value); }
};
void StdThread::threadMain(boost::shared_ptr<StdThread> thread) {
void StdThread::threadMain(stdcxx::shared_ptr<StdThread> thread) {
if (thread == NULL) {
return;
}
@@ -119,8 +117,8 @@ void StdThread::threadMain(boost::shared_ptr<StdThread> thread) {
StdThreadFactory::StdThreadFactory(bool detached) : ThreadFactory(detached) {
}
boost::shared_ptr<Thread> StdThreadFactory::newThread(boost::shared_ptr<Runnable> runnable) const {
boost::shared_ptr<StdThread> result = boost::shared_ptr<StdThread>(new StdThread(isDetached(), runnable));
stdcxx::shared_ptr<Thread> StdThreadFactory::newThread(stdcxx::shared_ptr<Runnable> runnable) const {
stdcxx::shared_ptr<StdThread> result = stdcxx::shared_ptr<StdThread>(new StdThread(isDetached(), runnable));
runnable->thread(result);
return result;
}

View File

@@ -22,7 +22,7 @@
#include <thrift/concurrency/Thread.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -38,8 +38,8 @@ class StdThreadFactory : public ThreadFactory {
public:
/**
* Std thread factory. All threads created by a factory are reference-counted
* via boost::shared_ptr and boost::weak_ptr. The factory guarantees that threads and
* the Runnable tasks they host will be properly cleaned up once the last strong reference
* via stdcxx::shared_ptr. The factory guarantees that threads and the Runnable tasks
* they host will be properly cleaned up once the last strong reference
* to both is given up.
*
* By default threads are not joinable.
@@ -48,7 +48,7 @@ public:
StdThreadFactory(bool detached = true);
// From ThreadFactory;
boost::shared_ptr<Thread> newThread(boost::shared_ptr<Runnable> runnable) const;
stdcxx::shared_ptr<Thread> newThread(stdcxx::shared_ptr<Runnable> runnable) const;
// From ThreadFactory;
Thread::id_t getCurrentThreadId() const;

View File

@@ -21,8 +21,7 @@
#define _THRIFT_CONCURRENCY_THREAD_H_ 1
#include <stdint.h>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <thrift/stdcxx.h>
#include <thrift/thrift-config.h>
@@ -57,16 +56,16 @@ public:
* Gets the thread object that is hosting this runnable object - can return
* an empty boost::shared pointer if no references remain on that thread object
*/
virtual boost::shared_ptr<Thread> thread() { return thread_.lock(); }
virtual stdcxx::shared_ptr<Thread> thread() { return thread_.lock(); }
/**
* Sets the thread that is executing this object. This is only meant for
* use by concrete implementations of Thread.
*/
virtual void thread(boost::shared_ptr<Thread> value) { thread_ = value; }
virtual void thread(stdcxx::shared_ptr<Thread> value) { thread_ = value; }
private:
boost::weak_ptr<Thread> thread_;
stdcxx::weak_ptr<Thread> thread_;
};
/**
@@ -122,13 +121,13 @@ public:
/**
* Gets the runnable object this thread is hosting
*/
virtual boost::shared_ptr<Runnable> runnable() const { return _runnable; }
virtual stdcxx::shared_ptr<Runnable> runnable() const { return _runnable; }
protected:
virtual void runnable(boost::shared_ptr<Runnable> value) { _runnable = value; }
virtual void runnable(stdcxx::shared_ptr<Runnable> value) { _runnable = value; }
private:
boost::shared_ptr<Runnable> _runnable;
stdcxx::shared_ptr<Runnable> _runnable;
};
/**
@@ -155,7 +154,7 @@ public:
/**
* Create a new thread.
*/
virtual boost::shared_ptr<Thread> newThread(boost::shared_ptr<Runnable> runnable) const = 0;
virtual stdcxx::shared_ptr<Thread> newThread(stdcxx::shared_ptr<Runnable> runnable) const = 0;
/**
* Gets the current thread id or unknown_thread_id if the current thread is not a thrift thread

View File

@@ -24,7 +24,7 @@
#include <thrift/concurrency/Monitor.h>
#include <thrift/concurrency/Util.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <stdexcept>
#include <deque>
@@ -34,8 +34,8 @@ namespace apache {
namespace thrift {
namespace concurrency {
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using stdcxx::shared_ptr;
using stdcxx::dynamic_pointer_cast;
/**
* ThreadManager class
@@ -504,7 +504,7 @@ void ThreadManager::Impl::remove(shared_ptr<Runnable> task) {
}
}
boost::shared_ptr<Runnable> ThreadManager::Impl::removeNextPending() {
stdcxx::shared_ptr<Runnable> ThreadManager::Impl::removeNextPending() {
Guard g(mutex_);
if (state_ != ThreadManager::STARTED) {
throw IllegalStateException(
@@ -513,7 +513,7 @@ boost::shared_ptr<Runnable> ThreadManager::Impl::removeNextPending() {
}
if (tasks_.empty()) {
return boost::shared_ptr<Runnable>();
return stdcxx::shared_ptr<Runnable>();
}
shared_ptr<ThreadManager::Task> task = tasks_.front();

View File

@@ -20,10 +20,9 @@
#ifndef _THRIFT_CONCURRENCY_THREADMANAGER_H_
#define _THRIFT_CONCURRENCY_THREADMANAGER_H_ 1
#include <boost/shared_ptr.hpp>
#include <thrift/cxxfunctional.h>
#include <sys/types.h>
#include <thrift/concurrency/Thread.h>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -59,7 +58,7 @@ protected:
ThreadManager() {}
public:
typedef apache::thrift::stdcxx::function<void(boost::shared_ptr<Runnable>)> ExpireCallback;
typedef apache::thrift::stdcxx::function<void(stdcxx::shared_ptr<Runnable>)> ExpireCallback;
virtual ~ThreadManager() {}
@@ -88,14 +87,14 @@ public:
/**
* \returns the current thread factory
*/
virtual boost::shared_ptr<ThreadFactory> threadFactory() const = 0;
virtual stdcxx::shared_ptr<ThreadFactory> threadFactory() const = 0;
/**
* Set the thread factory.
* \throws InvalidArgumentException if the new thread factory has a different
* detached disposition than the one replacing it
*/
virtual void threadFactory(boost::shared_ptr<ThreadFactory> value) = 0;
virtual void threadFactory(stdcxx::shared_ptr<ThreadFactory> value) = 0;
/**
* Adds worker thread(s).
@@ -162,21 +161,21 @@ public:
*
* @throws TooManyPendingTasksException Pending task count exceeds max pending task count
*/
virtual void add(boost::shared_ptr<Runnable> task,
virtual void add(stdcxx::shared_ptr<Runnable> task,
int64_t timeout = 0LL,
int64_t expiration = 0LL) = 0;
/**
* Removes a pending task
*/
virtual void remove(boost::shared_ptr<Runnable> task) = 0;
virtual void remove(stdcxx::shared_ptr<Runnable> task) = 0;
/**
* Remove the next pending task which would be run.
*
* @return the task removed.
*/
virtual boost::shared_ptr<Runnable> removeNextPending() = 0;
virtual stdcxx::shared_ptr<Runnable> removeNextPending() = 0;
/**
* Remove tasks from front of task queue that have expired.
@@ -191,14 +190,14 @@ public:
*/
virtual void setExpireCallback(ExpireCallback expireCallback) = 0;
static boost::shared_ptr<ThreadManager> newThreadManager();
static stdcxx::shared_ptr<ThreadManager> newThreadManager();
/**
* Creates a simple thread manager the uses count number of worker threads and has
* a pendingTaskCountMax maximum pending tasks. The default, 0, specified no limit
* on pending tasks
*/
static boost::shared_ptr<ThreadManager> newSimpleThreadManager(size_t count = 4,
static stdcxx::shared_ptr<ThreadManager> newSimpleThreadManager(size_t count = 4,
size_t pendingTaskCountMax = 0);
class Task;

View File

@@ -29,7 +29,7 @@ namespace apache {
namespace thrift {
namespace concurrency {
using boost::shared_ptr;
using stdcxx::shared_ptr;
/**
* TimerManager class

View File

@@ -24,7 +24,7 @@
#include <thrift/concurrency/Monitor.h>
#include <thrift/concurrency/Thread.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <map>
#include <time.h>
@@ -46,9 +46,9 @@ public:
virtual ~TimerManager();
virtual boost::shared_ptr<const ThreadFactory> threadFactory() const;
virtual stdcxx::shared_ptr<const ThreadFactory> threadFactory() const;
virtual void threadFactory(boost::shared_ptr<const ThreadFactory> value);
virtual void threadFactory(stdcxx::shared_ptr<const ThreadFactory> value);
/**
* Starts the timer manager service
@@ -70,7 +70,7 @@ public:
* @param task The task to execute
* @param timeout Time in milliseconds to delay before executing task
*/
virtual void add(boost::shared_ptr<Runnable> task, int64_t timeout);
virtual void add(stdcxx::shared_ptr<Runnable> task, int64_t timeout);
/**
* Adds a task to be executed at some time in the future by a worker thread.
@@ -78,7 +78,7 @@ public:
* @param task The task to execute
* @param timeout Absolute time in the future to execute task.
*/
virtual void add(boost::shared_ptr<Runnable> task, const struct THRIFT_TIMESPEC& timeout);
virtual void add(stdcxx::shared_ptr<Runnable> task, const struct THRIFT_TIMESPEC& timeout);
/**
* Adds a task to be executed at some time in the future by a worker thread.
@@ -86,7 +86,7 @@ public:
* @param task The task to execute
* @param timeout Absolute time in the future to execute task.
*/
virtual void add(boost::shared_ptr<Runnable> task, const struct timeval& timeout);
virtual void add(stdcxx::shared_ptr<Runnable> task, const struct timeval& timeout);
/**
* Removes a pending task
@@ -98,25 +98,25 @@ public:
* @throws UncancellableTaskException Specified task is already being
* executed or has completed execution.
*/
virtual void remove(boost::shared_ptr<Runnable> task);
virtual void remove(stdcxx::shared_ptr<Runnable> task);
enum STATE { UNINITIALIZED, STARTING, STARTED, STOPPING, STOPPED };
virtual STATE state() const;
private:
boost::shared_ptr<const ThreadFactory> threadFactory_;
stdcxx::shared_ptr<const ThreadFactory> threadFactory_;
class Task;
friend class Task;
std::multimap<int64_t, boost::shared_ptr<Task> > taskMap_;
std::multimap<int64_t, stdcxx::shared_ptr<Task> > taskMap_;
size_t taskCount_;
Monitor monitor_;
STATE state_;
class Dispatcher;
friend class Dispatcher;
boost::shared_ptr<Dispatcher> dispatcher_;
boost::shared_ptr<Thread> dispatcherThread_;
typedef std::multimap<int64_t, boost::shared_ptr<TimerManager::Task> >::iterator task_iterator;
stdcxx::shared_ptr<Dispatcher> dispatcher_;
stdcxx::shared_ptr<Thread> dispatcherThread_;
typedef std::multimap<int64_t, stdcxx::shared_ptr<TimerManager::Task> >::iterator task_iterator;
typedef std::pair<task_iterator, task_iterator> task_range;
};
}

View File

@@ -1,132 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef _THRIFT_CXXFUNCTIONAL_H_
#define _THRIFT_CXXFUNCTIONAL_H_ 1
// clang-format off
/**
* Loads <functional> from the 'right' location, depending
* on compiler and whether or not it's using C++03 with TR1
* or C++11.
*/
/*
* MSVC 10 and 11 have the <functional> stuff at <functional>.
* In MSVC 10 all of the implementations live in std::tr1.
* In MSVC 11 all of the implementations live in std, with aliases
* in std::tr1 to point to the ones in std.
*/
#if defined(_WIN32) && !defined(__MINGW32__)
#define _THRIFT_USING_MICROSOFT_STDLIB 1
#endif
#ifdef __clang__
/* Clang has two options, depending on standard library:
* - no -stdlib or -stdlib=libstdc++ set; uses GNU libstdc++.
* <tr1/functional>
* - -stdlib=libc++; uses LLVM libc++.
* <functional>, no 'std::tr1'.
*
* The compiler itself doesn't define anything differently
* depending on the value of -stdlib, but the library headers
* will set different preprocessor options. In order to check,
* though, we have to pull in some library header.
*/
#include <utility>
/* With LLVM libc++, utility pulls in __config, which sets
_LIBCPP_VERSION. */
#if defined(_LIBCPP_VERSION)
#define _THRIFT_USING_CLANG_LIBCXX 1
/* With GNU libstdc++, utility pulls in bits/c++config.h,
which sets __GLIBCXX__. */
#elif defined(__GLIBCXX__)
#define _THRIFT_USING_GNU_LIBSTDCXX 1
/* No idea. */
#else
#error Unable to detect which C++ standard library is in use.
#endif
#elif __GNUC__
#define _THRIFT_USING_GNU_LIBSTDCXX 1
#endif
#if _THRIFT_USING_MICROSOFT_STDLIB
#include <functional>
namespace apache { namespace thrift { namespace stdcxx {
using ::std::tr1::function;
using ::std::tr1::bind;
namespace placeholders {
using ::std::tr1::placeholders::_1;
using ::std::tr1::placeholders::_2;
using ::std::tr1::placeholders::_3;
using ::std::tr1::placeholders::_4;
using ::std::tr1::placeholders::_5;
using ::std::tr1::placeholders::_6;
} // apache::thrift::stdcxx::placeholders
}}} // apache::thrift::stdcxx
#elif _THRIFT_USING_CLANG_LIBCXX
#include <functional>
namespace apache { namespace thrift { namespace stdcxx {
using ::std::function;
using ::std::bind;
namespace placeholders {
using ::std::placeholders::_1;
using ::std::placeholders::_2;
using ::std::placeholders::_3;
using ::std::placeholders::_4;
using ::std::placeholders::_5;
using ::std::placeholders::_6;
} // apache::thrift::stdcxx::placeholders
}}} // apache::thrift::stdcxx
#elif _THRIFT_USING_GNU_LIBSTDCXX
#ifdef USE_BOOST_THREAD
#include <boost/tr1/functional.hpp>
#else
#include <tr1/functional>
#endif
namespace apache { namespace thrift { namespace stdcxx {
using ::std::tr1::function;
using ::std::tr1::bind;
namespace placeholders {
using ::std::tr1::placeholders::_1;
using ::std::tr1::placeholders::_2;
using ::std::tr1::placeholders::_3;
using ::std::tr1::placeholders::_4;
using ::std::tr1::placeholders::_5;
using ::std::tr1::placeholders::_6;
} // apache::thrift::stdcxx::placeholders
}}} // apache::thrift::stdcxx
#endif
// Alias for thrift c++ compatibility namespace
namespace tcxx = apache::thrift::stdcxx;
#endif // #ifndef _THRIFT_CXXFUNCTIONAL_H_

View File

@@ -34,26 +34,26 @@ PeekProcessor::PeekProcessor() {
PeekProcessor::~PeekProcessor() {
}
void PeekProcessor::initialize(boost::shared_ptr<TProcessor> actualProcessor,
boost::shared_ptr<TProtocolFactory> protocolFactory,
boost::shared_ptr<TPipedTransportFactory> transportFactory) {
void PeekProcessor::initialize(stdcxx::shared_ptr<TProcessor> actualProcessor,
stdcxx::shared_ptr<TProtocolFactory> protocolFactory,
stdcxx::shared_ptr<TPipedTransportFactory> transportFactory) {
actualProcessor_ = actualProcessor;
pipedProtocol_ = protocolFactory->getProtocol(targetTransport_);
transportFactory_ = transportFactory;
transportFactory_->initializeTargetTransport(targetTransport_);
}
boost::shared_ptr<TTransport> PeekProcessor::getPipedTransport(boost::shared_ptr<TTransport> in) {
stdcxx::shared_ptr<TTransport> PeekProcessor::getPipedTransport(stdcxx::shared_ptr<TTransport> in) {
return transportFactory_->getTransport(in);
}
void PeekProcessor::setTargetTransport(boost::shared_ptr<TTransport> targetTransport) {
void PeekProcessor::setTargetTransport(stdcxx::shared_ptr<TTransport> targetTransport) {
targetTransport_ = targetTransport;
if (boost::dynamic_pointer_cast<TMemoryBuffer>(targetTransport_)) {
memoryBuffer_ = boost::dynamic_pointer_cast<TMemoryBuffer>(targetTransport);
} else if (boost::dynamic_pointer_cast<TPipedTransport>(targetTransport_)) {
memoryBuffer_ = boost::dynamic_pointer_cast<TMemoryBuffer>(
boost::dynamic_pointer_cast<TPipedTransport>(targetTransport_)->getTargetTransport());
if (stdcxx::dynamic_pointer_cast<TMemoryBuffer>(targetTransport_)) {
memoryBuffer_ = stdcxx::dynamic_pointer_cast<TMemoryBuffer>(targetTransport);
} else if (stdcxx::dynamic_pointer_cast<TPipedTransport>(targetTransport_)) {
memoryBuffer_ = stdcxx::dynamic_pointer_cast<TMemoryBuffer>(
stdcxx::dynamic_pointer_cast<TPipedTransport>(targetTransport_)->getTargetTransport());
}
if (!memoryBuffer_) {
@@ -62,8 +62,8 @@ void PeekProcessor::setTargetTransport(boost::shared_ptr<TTransport> targetTrans
}
}
bool PeekProcessor::process(boost::shared_ptr<TProtocol> in,
boost::shared_ptr<TProtocol> out,
bool PeekProcessor::process(stdcxx::shared_ptr<TProtocol> in,
stdcxx::shared_ptr<TProtocol> out,
void* connectionContext) {
std::string fname;
@@ -120,7 +120,7 @@ void PeekProcessor::peekBuffer(uint8_t* buffer, uint32_t size) {
(void)size;
}
void PeekProcessor::peek(boost::shared_ptr<TProtocol> in, TType ftype, int16_t fid) {
void PeekProcessor::peek(stdcxx::shared_ptr<TProtocol> in, TType ftype, int16_t fid) {
(void)fid;
in->skip(ftype);
}

View File

@@ -25,7 +25,7 @@
#include <thrift/transport/TTransport.h>
#include <thrift/transport/TTransportUtils.h>
#include <thrift/transport/TBufferTransports.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -47,34 +47,34 @@ public:
// transportFactory - this TPipedTransportFactory is used to wrap the source transport
// via a call to getPipedTransport
void initialize(
boost::shared_ptr<apache::thrift::TProcessor> actualProcessor,
boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> protocolFactory,
boost::shared_ptr<apache::thrift::transport::TPipedTransportFactory> transportFactory);
stdcxx::shared_ptr<apache::thrift::TProcessor> actualProcessor,
stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory> protocolFactory,
stdcxx::shared_ptr<apache::thrift::transport::TPipedTransportFactory> transportFactory);
boost::shared_ptr<apache::thrift::transport::TTransport> getPipedTransport(
boost::shared_ptr<apache::thrift::transport::TTransport> in);
stdcxx::shared_ptr<apache::thrift::transport::TTransport> getPipedTransport(
stdcxx::shared_ptr<apache::thrift::transport::TTransport> in);
void setTargetTransport(boost::shared_ptr<apache::thrift::transport::TTransport> targetTransport);
void setTargetTransport(stdcxx::shared_ptr<apache::thrift::transport::TTransport> targetTransport);
virtual bool process(boost::shared_ptr<apache::thrift::protocol::TProtocol> in,
boost::shared_ptr<apache::thrift::protocol::TProtocol> out,
virtual bool process(stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> in,
stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> out,
void* connectionContext);
// The following three functions can be overloaded by child classes to
// achieve desired peeking behavior
virtual void peekName(const std::string& fname);
virtual void peekBuffer(uint8_t* buffer, uint32_t size);
virtual void peek(boost::shared_ptr<apache::thrift::protocol::TProtocol> in,
virtual void peek(stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> in,
apache::thrift::protocol::TType ftype,
int16_t fid);
virtual void peekEnd();
private:
boost::shared_ptr<apache::thrift::TProcessor> actualProcessor_;
boost::shared_ptr<apache::thrift::protocol::TProtocol> pipedProtocol_;
boost::shared_ptr<apache::thrift::transport::TPipedTransportFactory> transportFactory_;
boost::shared_ptr<apache::thrift::transport::TMemoryBuffer> memoryBuffer_;
boost::shared_ptr<apache::thrift::transport::TTransport> targetTransport_;
stdcxx::shared_ptr<apache::thrift::TProcessor> actualProcessor_;
stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> pipedProtocol_;
stdcxx::shared_ptr<apache::thrift::transport::TPipedTransportFactory> transportFactory_;
stdcxx::shared_ptr<apache::thrift::transport::TMemoryBuffer> memoryBuffer_;
stdcxx::shared_ptr<apache::thrift::transport::TTransport> targetTransport_;
};
}
}

View File

@@ -20,7 +20,7 @@
#ifndef STATSPROCESSOR_H
#define STATSPROCESSOR_H
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <thrift/transport/TTransport.h>
#include <thrift/protocol/TProtocol.h>
#include <TProcessor.h>
@@ -38,8 +38,8 @@ public:
StatsProcessor(bool print, bool frequency) : print_(print), frequency_(frequency) {}
virtual ~StatsProcessor(){};
virtual bool process(boost::shared_ptr<apache::thrift::protocol::TProtocol> piprot,
boost::shared_ptr<apache::thrift::protocol::TProtocol> poprot,
virtual bool process(stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> piprot,
stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> poprot,
void* serverContext) {
piprot_ = piprot;
@@ -229,7 +229,7 @@ protected:
}
}
boost::shared_ptr<apache::thrift::protocol::TProtocol> piprot_;
stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> piprot_;
std::map<std::string, int64_t> frequency_map_;
bool print_;

View File

@@ -27,7 +27,7 @@
namespace apache {
namespace thrift {
using boost::shared_ptr;
using stdcxx::shared_ptr;
namespace protocol {

View File

@@ -23,7 +23,7 @@
#include <thrift/protocol/TProtocol.h>
#include <thrift/protocol/TVirtualProtocol.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -41,7 +41,7 @@ public:
static const int32_t VERSION_1 = ((int32_t)0x80010000);
// VERSION_2 (0x80020000) was taken by TDenseProtocol (which has since been removed)
TBinaryProtocolT(boost::shared_ptr<Transport_> trans)
TBinaryProtocolT(stdcxx::shared_ptr<Transport_> trans)
: TVirtualProtocol<TBinaryProtocolT<Transport_, ByteOrder_> >(trans),
trans_(trans.get()),
string_limit_(0),
@@ -49,7 +49,7 @@ public:
strict_read_(false),
strict_write_(true) {}
TBinaryProtocolT(boost::shared_ptr<Transport_> trans,
TBinaryProtocolT(stdcxx::shared_ptr<Transport_> trans,
int32_t string_limit,
int32_t container_limit,
bool strict_read,
@@ -212,8 +212,8 @@ public:
strict_write_ = strict_write;
}
boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> trans) {
boost::shared_ptr<Transport_> specific_trans = boost::dynamic_pointer_cast<Transport_>(trans);
stdcxx::shared_ptr<TProtocol> getProtocol(stdcxx::shared_ptr<TTransport> trans) {
stdcxx::shared_ptr<Transport_> specific_trans = stdcxx::dynamic_pointer_cast<Transport_>(trans);
TProtocol* prot;
if (specific_trans) {
prot = new TBinaryProtocolT<Transport_, ByteOrder_>(specific_trans,
@@ -229,7 +229,7 @@ public:
strict_write_);
}
return boost::shared_ptr<TProtocol>(prot);
return stdcxx::shared_ptr<TProtocol>(prot);
}
private:

View File

@@ -23,7 +23,7 @@
#include <thrift/protocol/TVirtualProtocol.h>
#include <stack>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -74,7 +74,7 @@ protected:
int16_t lastFieldId_;
public:
TCompactProtocolT(boost::shared_ptr<Transport_> trans)
TCompactProtocolT(stdcxx::shared_ptr<Transport_> trans)
: TVirtualProtocol<TCompactProtocolT<Transport_> >(trans),
trans_(trans.get()),
lastFieldId_(0),
@@ -86,7 +86,7 @@ public:
boolValue_.hasBoolValue = false;
}
TCompactProtocolT(boost::shared_ptr<Transport_> trans,
TCompactProtocolT(stdcxx::shared_ptr<Transport_> trans,
int32_t string_limit,
int32_t container_limit)
: TVirtualProtocol<TCompactProtocolT<Transport_> >(trans),
@@ -239,8 +239,8 @@ public:
void setContainerSizeLimit(int32_t container_limit) { container_limit_ = container_limit; }
boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> trans) {
boost::shared_ptr<Transport_> specific_trans = boost::dynamic_pointer_cast<Transport_>(trans);
stdcxx::shared_ptr<TProtocol> getProtocol(stdcxx::shared_ptr<TTransport> trans) {
stdcxx::shared_ptr<Transport_> specific_trans = stdcxx::dynamic_pointer_cast<Transport_>(trans);
TProtocol* prot;
if (specific_trans) {
prot = new TCompactProtocolT<Transport_>(specific_trans, string_limit_, container_limit_);
@@ -248,7 +248,7 @@ public:
prot = new TCompactProtocol(trans, string_limit_, container_limit_);
}
return boost::shared_ptr<TProtocol>(prot);
return stdcxx::shared_ptr<TProtocol>(prot);
}
private:

View File

@@ -22,7 +22,7 @@
#include <thrift/protocol/TVirtualProtocol.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -51,7 +51,7 @@ private:
enum write_state_t { UNINIT, STRUCT, LIST, SET, MAP_KEY, MAP_VALUE };
public:
TDebugProtocol(boost::shared_ptr<TTransport> trans)
TDebugProtocol(stdcxx::shared_ptr<TTransport> trans)
: TVirtualProtocol<TDebugProtocol>(trans),
trans_(trans.get()),
string_limit_(DEFAULT_STRING_LIMIT),
@@ -141,8 +141,8 @@ public:
TDebugProtocolFactory() {}
virtual ~TDebugProtocolFactory() {}
boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> trans) {
return boost::shared_ptr<TProtocol>(new TDebugProtocol(trans));
stdcxx::shared_ptr<TProtocol> getProtocol(stdcxx::shared_ptr<TTransport> trans) {
return stdcxx::shared_ptr<TProtocol>(new TDebugProtocol(trans));
}
};
}
@@ -160,7 +160,7 @@ std::string ThriftDebugString(const ThriftStruct& ts) {
using namespace apache::thrift::transport;
using namespace apache::thrift::protocol;
TMemoryBuffer* buffer = new TMemoryBuffer;
boost::shared_ptr<TTransport> trans(buffer);
stdcxx::shared_ptr<TTransport> trans(buffer);
TDebugProtocol protocol(trans);
ts.write(&protocol);
@@ -178,7 +178,7 @@ std::string DebugString(const std::vector<Object>& vec) {
using namespace apache::thrift::transport;
using namespace apache::thrift::protocol;
TMemoryBuffer* buffer = new TMemoryBuffer;
boost::shared_ptr<TTransport> trans(buffer);
stdcxx::shared_ptr<TTransport> trans(buffer);
TDebugProtocol protocol(trans);
// I am gross!

View File

@@ -27,7 +27,7 @@
#include <limits>
#include <boost/static_assert.hpp>
#include <boost/make_shared.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -42,11 +42,11 @@ void THeaderProtocol::resetProtocol() {
switch (protoId_) {
case T_BINARY_PROTOCOL:
proto_ = boost::make_shared<TBinaryProtocolT<THeaderTransport> >(trans_);
proto_ = stdcxx::make_shared<TBinaryProtocolT<THeaderTransport> >(trans_);
break;
case T_COMPACT_PROTOCOL:
proto_ = boost::make_shared<TCompactProtocolT<THeaderTransport> >(trans_);
proto_ = stdcxx::make_shared<TCompactProtocolT<THeaderTransport> >(trans_);
break;
default:

View File

@@ -25,7 +25,7 @@
#include <thrift/protocol/TVirtualProtocol.h>
#include <thrift/transport/THeaderTransport.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
using apache::thrift::transport::THeaderTransport;
@@ -43,21 +43,21 @@ protected:
public:
void resetProtocol();
explicit THeaderProtocol(const boost::shared_ptr<TTransport>& trans,
explicit THeaderProtocol(const stdcxx::shared_ptr<TTransport>& trans,
uint16_t protoId = T_COMPACT_PROTOCOL)
: TVirtualProtocol<THeaderProtocol>(boost::shared_ptr<TTransport>(new THeaderTransport(trans))),
trans_(boost::dynamic_pointer_cast<THeaderTransport>(getTransport())),
: TVirtualProtocol<THeaderProtocol>(stdcxx::shared_ptr<TTransport>(new THeaderTransport(trans))),
trans_(stdcxx::dynamic_pointer_cast<THeaderTransport>(getTransport())),
protoId_(protoId) {
trans_->setProtocolId(protoId);
resetProtocol();
}
THeaderProtocol(const boost::shared_ptr<TTransport>& inTrans,
const boost::shared_ptr<TTransport>& outTrans,
THeaderProtocol(const stdcxx::shared_ptr<TTransport>& inTrans,
const stdcxx::shared_ptr<TTransport>& outTrans,
uint16_t protoId = T_COMPACT_PROTOCOL)
: TVirtualProtocol<THeaderProtocol>(
boost::shared_ptr<TTransport>(new THeaderTransport(inTrans, outTrans))),
trans_(boost::dynamic_pointer_cast<THeaderTransport>(getTransport())),
stdcxx::shared_ptr<TTransport>(new THeaderTransport(inTrans, outTrans))),
trans_(stdcxx::dynamic_pointer_cast<THeaderTransport>(getTransport())),
protoId_(protoId) {
trans_->setProtocolId(protoId);
resetProtocol();
@@ -182,25 +182,25 @@ public:
uint32_t readBinary(std::string& binary);
protected:
boost::shared_ptr<THeaderTransport> trans_;
stdcxx::shared_ptr<THeaderTransport> trans_;
boost::shared_ptr<TProtocol> proto_;
stdcxx::shared_ptr<TProtocol> proto_;
uint32_t protoId_;
};
class THeaderProtocolFactory : public TProtocolFactory {
public:
virtual boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<transport::TTransport> trans) {
virtual stdcxx::shared_ptr<TProtocol> getProtocol(stdcxx::shared_ptr<transport::TTransport> trans) {
THeaderProtocol* headerProtocol
= new THeaderProtocol(trans, boost::shared_ptr<transport::TTransport>(), T_BINARY_PROTOCOL);
return boost::shared_ptr<TProtocol>(headerProtocol);
= new THeaderProtocol(trans, stdcxx::shared_ptr<transport::TTransport>(), T_BINARY_PROTOCOL);
return stdcxx::shared_ptr<TProtocol>(headerProtocol);
}
virtual boost::shared_ptr<TProtocol> getProtocol(
boost::shared_ptr<transport::TTransport> inTrans,
boost::shared_ptr<transport::TTransport> outTrans) {
virtual stdcxx::shared_ptr<TProtocol> getProtocol(
stdcxx::shared_ptr<transport::TTransport> inTrans,
stdcxx::shared_ptr<transport::TTransport> outTrans) {
THeaderProtocol* headerProtocol = new THeaderProtocol(inTrans, outTrans, T_BINARY_PROTOCOL);
return boost::shared_ptr<TProtocol>(headerProtocol);
return stdcxx::shared_ptr<TProtocol>(headerProtocol);
}
};
}

View File

@@ -398,7 +398,7 @@ private:
bool first_;
};
TJSONProtocol::TJSONProtocol(boost::shared_ptr<TTransport> ptrans)
TJSONProtocol::TJSONProtocol(stdcxx::shared_ptr<TTransport> ptrans)
: TVirtualProtocol<TJSONProtocol>(ptrans),
trans_(ptrans.get()),
context_(new TJSONContext()),
@@ -408,7 +408,7 @@ TJSONProtocol::TJSONProtocol(boost::shared_ptr<TTransport> ptrans)
TJSONProtocol::~TJSONProtocol() {
}
void TJSONProtocol::pushContext(boost::shared_ptr<TJSONContext> c) {
void TJSONProtocol::pushContext(stdcxx::shared_ptr<TJSONContext> c) {
contexts_.push(context_);
context_ = c;
}
@@ -576,7 +576,7 @@ uint32_t TJSONProtocol::writeJSONDouble(double num) {
uint32_t TJSONProtocol::writeJSONObjectStart() {
uint32_t result = context_->write(*trans_);
trans_->write(&kJSONObjectStart, 1);
pushContext(boost::shared_ptr<TJSONContext>(new JSONPairContext()));
pushContext(stdcxx::shared_ptr<TJSONContext>(new JSONPairContext()));
return result + 1;
}
@@ -589,7 +589,7 @@ uint32_t TJSONProtocol::writeJSONObjectEnd() {
uint32_t TJSONProtocol::writeJSONArrayStart() {
uint32_t result = context_->write(*trans_);
trans_->write(&kJSONArrayStart, 1);
pushContext(boost::shared_ptr<TJSONContext>(new JSONListContext()));
pushContext(stdcxx::shared_ptr<TJSONContext>(new JSONListContext()));
return result + 1;
}
@@ -923,7 +923,7 @@ uint32_t TJSONProtocol::readJSONDouble(double& num) {
uint32_t TJSONProtocol::readJSONObjectStart() {
uint32_t result = context_->read(reader_);
result += readJSONSyntaxChar(kJSONObjectStart);
pushContext(boost::shared_ptr<TJSONContext>(new JSONPairContext()));
pushContext(stdcxx::shared_ptr<TJSONContext>(new JSONPairContext()));
return result;
}
@@ -936,7 +936,7 @@ uint32_t TJSONProtocol::readJSONObjectEnd() {
uint32_t TJSONProtocol::readJSONArrayStart() {
uint32_t result = context_->read(reader_);
result += readJSONSyntaxChar(kJSONArrayStart);
pushContext(boost::shared_ptr<TJSONContext>(new JSONListContext()));
pushContext(stdcxx::shared_ptr<TJSONContext>(new JSONListContext()));
return result;
}

View File

@@ -96,12 +96,12 @@ class TJSONContext;
*/
class TJSONProtocol : public TVirtualProtocol<TJSONProtocol> {
public:
TJSONProtocol(boost::shared_ptr<TTransport> ptrans);
TJSONProtocol(stdcxx::shared_ptr<TTransport> ptrans);
~TJSONProtocol();
private:
void pushContext(boost::shared_ptr<TJSONContext> c);
void pushContext(stdcxx::shared_ptr<TJSONContext> c);
void popContext();
@@ -276,8 +276,8 @@ public:
private:
TTransport* trans_;
std::stack<boost::shared_ptr<TJSONContext> > contexts_;
boost::shared_ptr<TJSONContext> context_;
std::stack<stdcxx::shared_ptr<TJSONContext> > contexts_;
stdcxx::shared_ptr<TJSONContext> context_;
LookaheadReader reader_;
};
@@ -290,8 +290,8 @@ public:
virtual ~TJSONProtocolFactory() {}
boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> trans) {
return boost::shared_ptr<TProtocol>(new TJSONProtocol(trans));
stdcxx::shared_ptr<TProtocol> getProtocol(stdcxx::shared_ptr<TTransport> trans) {
return stdcxx::shared_ptr<TProtocol>(new TJSONProtocol(trans));
}
};
}
@@ -309,7 +309,7 @@ std::string ThriftJSONString(const ThriftStruct& ts) {
using namespace apache::thrift::transport;
using namespace apache::thrift::protocol;
TMemoryBuffer* buffer = new TMemoryBuffer;
boost::shared_ptr<TTransport> trans(buffer);
stdcxx::shared_ptr<TTransport> trans(buffer);
TJSONProtocol protocol(trans);
ts.write(&protocol);

View File

@@ -25,7 +25,7 @@
namespace apache {
namespace thrift {
namespace protocol {
using boost::shared_ptr;
using stdcxx::shared_ptr;
/**
* <code>TMultiplexedProtocol</code> is a protocol-independent concrete decorator

View File

@@ -28,7 +28,7 @@
#include <thrift/transport/TTransport.h>
#include <thrift/protocol/TProtocolException.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <boost/static_assert.hpp>
#ifdef HAVE_NETINET_IN_H
@@ -550,12 +550,12 @@ public:
}
virtual uint32_t skip_virt(TType type);
inline boost::shared_ptr<TTransport> getTransport() { return ptrans_; }
inline stdcxx::shared_ptr<TTransport> getTransport() { return ptrans_; }
// TODO: remove these two calls, they are for backwards
// compatibility
inline boost::shared_ptr<TTransport> getInputTransport() { return ptrans_; }
inline boost::shared_ptr<TTransport> getOutputTransport() { return ptrans_; }
inline stdcxx::shared_ptr<TTransport> getInputTransport() { return ptrans_; }
inline stdcxx::shared_ptr<TTransport> getOutputTransport() { return ptrans_; }
// input and output recursion depth are kept separate so that one protocol
// can be used concurrently for both input and output.
@@ -577,11 +577,11 @@ public:
void setRecurisionLimit(uint32_t depth) {recursion_limit_ = depth;}
protected:
TProtocol(boost::shared_ptr<TTransport> ptrans)
TProtocol(stdcxx::shared_ptr<TTransport> ptrans)
: ptrans_(ptrans), input_recursion_depth_(0), output_recursion_depth_(0), recursion_limit_(DEFAULT_RECURSION_LIMIT)
{}
boost::shared_ptr<TTransport> ptrans_;
stdcxx::shared_ptr<TTransport> ptrans_;
private:
TProtocol() {}
@@ -599,9 +599,9 @@ public:
virtual ~TProtocolFactory();
virtual boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> trans) = 0;
virtual boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> inTrans,
boost::shared_ptr<TTransport> outTrans) {
virtual stdcxx::shared_ptr<TProtocol> getProtocol(stdcxx::shared_ptr<TTransport> trans) = 0;
virtual stdcxx::shared_ptr<TProtocol> getProtocol(stdcxx::shared_ptr<TTransport> inTrans,
stdcxx::shared_ptr<TTransport> outTrans) {
(void)outTrans;
return getProtocol(inTrans);
}

View File

@@ -21,12 +21,12 @@
#define THRIFT_TPROTOCOLDECORATOR_H_ 1
#include <thrift/protocol/TProtocol.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
namespace protocol {
using boost::shared_ptr;
using stdcxx::shared_ptr;
/**
* <code>TProtocolDecorator</code> forwards all requests to an enclosed

View File

@@ -36,7 +36,7 @@ using apache::thrift::transport::TTransport;
*/
class TProtocolTap : public TVirtualProtocol<TProtocolTap> {
public:
TProtocolTap(boost::shared_ptr<TProtocol> source, boost::shared_ptr<TProtocol> sink)
TProtocolTap(stdcxx::shared_ptr<TProtocol> source, stdcxx::shared_ptr<TProtocol> sink)
: TVirtualProtocol<TProtocolTap>(source->getTransport()), source_(source), sink_(sink) {}
uint32_t readMessageBegin(std::string& name, TMessageType& messageType, int32_t& seqid) {
@@ -167,8 +167,8 @@ public:
}
private:
boost::shared_ptr<TProtocol> source_;
boost::shared_ptr<TProtocol> sink_;
stdcxx::shared_ptr<TProtocol> source_;
stdcxx::shared_ptr<TProtocol> sink_;
};
}
}

View File

@@ -301,7 +301,7 @@ public:
uint32_t skip(TType type) { return ::apache::thrift::protocol::skip(*this, type); }
protected:
TProtocolDefaults(boost::shared_ptr<TTransport> ptrans) : TProtocol(ptrans) {}
TProtocolDefaults(stdcxx::shared_ptr<TTransport> ptrans) : TProtocol(ptrans) {}
};
/**
@@ -504,7 +504,7 @@ public:
using Super_::readBool; // so we don't hide readBool(bool&)
protected:
TVirtualProtocol(boost::shared_ptr<TTransport> ptrans) : Super_(ptrans) {}
TVirtualProtocol(stdcxx::shared_ptr<TTransport> ptrans) : Super_(ptrans) {}
};
}
}

View File

@@ -23,11 +23,13 @@
#include <QIODevice>
#include <thrift/transport/TBufferTransports.h>
using boost::shared_ptr;
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
using stdcxx::shared_ptr;
namespace transport {
TQIODeviceTransport::TQIODeviceTransport(shared_ptr<QIODevice> dev) : dev_(dev) {

View File

@@ -20,7 +20,7 @@
#ifndef _THRIFT_ASYNC_TQIODEVICE_TRANSPORT_H_
#define _THRIFT_ASYNC_TQIODEVICE_TRANSPORT_H_ 1
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <thrift/transport/TVirtualTransport.h>
@@ -36,7 +36,7 @@ namespace transport {
class TQIODeviceTransport
: public apache::thrift::transport::TVirtualTransport<TQIODeviceTransport> {
public:
explicit TQIODeviceTransport(boost::shared_ptr<QIODevice> dev);
explicit TQIODeviceTransport(stdcxx::shared_ptr<QIODevice> dev);
virtual ~TQIODeviceTransport();
void open();
@@ -59,7 +59,7 @@ private:
TQIODeviceTransport(const TQIODeviceTransport&);
TQIODeviceTransport& operator=(const TQIODeviceTransport&);
boost::shared_ptr<QIODevice> dev_;
stdcxx::shared_ptr<QIODevice> dev_;
};
}
}

View File

@@ -23,19 +23,20 @@
#include <QMetaType>
#include <QTcpSocket>
#include <thrift/cxxfunctional.h>
#include <thrift/stdcxx.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/async/TAsyncProcessor.h>
using boost::shared_ptr;
using apache::thrift::protocol::TProtocol;
using apache::thrift::protocol::TProtocolFactory;
using apache::thrift::transport::TTransport;
using apache::thrift::transport::TTransportException;
using apache::thrift::transport::TQIODeviceTransport;
using apache::thrift::stdcxx::function;
using apache::thrift::stdcxx::bind;
using apache::thrift::stdcxx::function;
using apache::thrift::stdcxx::placeholders::_1;
using apache::thrift::stdcxx::shared_ptr;
QT_USE_NAMESPACE
@@ -110,7 +111,7 @@ void TQTcpServer::beginDecode() {
try {
processor_
->process(bind(&TQTcpServer::finish, this, ctx, apache::thrift::stdcxx::placeholders::_1),
->process(bind(&TQTcpServer::finish, this, ctx, _1),
ctx->iprot_,
ctx->oprot_);
} catch (const TTransportException& ex) {

View File

@@ -23,7 +23,7 @@
#include <QObject>
#include <QTcpServer>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -47,9 +47,9 @@ class TAsyncProcessor;
class TQTcpServer : public QObject {
Q_OBJECT
public:
TQTcpServer(boost::shared_ptr<QTcpServer> server,
boost::shared_ptr<TAsyncProcessor> processor,
boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> protocolFactory,
TQTcpServer(stdcxx::shared_ptr<QTcpServer> server,
stdcxx::shared_ptr<TAsyncProcessor> processor,
stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory> protocolFactory,
QObject* parent = NULL);
virtual ~TQTcpServer();
@@ -65,13 +65,13 @@ private:
struct ConnectionContext;
void scheduleDeleteConnectionContext(QTcpSocket* connection);
void finish(boost::shared_ptr<ConnectionContext> ctx, bool healthy);
void finish(stdcxx::shared_ptr<ConnectionContext> ctx, bool healthy);
boost::shared_ptr<QTcpServer> server_;
boost::shared_ptr<TAsyncProcessor> processor_;
boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> pfact_;
stdcxx::shared_ptr<QTcpServer> server_;
stdcxx::shared_ptr<TAsyncProcessor> processor_;
stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory> pfact_;
typedef std::map<QTcpSocket*, boost::shared_ptr<ConnectionContext> > ConnectionContextMap;
typedef std::map<QTcpSocket*, stdcxx::shared_ptr<ConnectionContext> > ConnectionContextMap;
ConnectionContextMap ctxMap_;
};
}

View File

@@ -28,7 +28,7 @@ using apache::thrift::protocol::TProtocol;
using apache::thrift::server::TServerEventHandler;
using apache::thrift::transport::TTransport;
using apache::thrift::transport::TTransportException;
using boost::shared_ptr;
using stdcxx::shared_ptr;
using std::string;
TConnectedClient::TConnectedClient(const shared_ptr<TProcessor>& processor,

View File

@@ -20,7 +20,7 @@
#ifndef _THRIFT_SERVER_TCONNECTEDCLIENT_H_
#define _THRIFT_SERVER_TCONNECTEDCLIENT_H_ 1
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <thrift/TProcessor.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/server/TServer.h>
@@ -49,11 +49,11 @@ public:
* @param[in] client the TTransport representing the client
*/
TConnectedClient(
const boost::shared_ptr<apache::thrift::TProcessor>& processor,
const boost::shared_ptr<apache::thrift::protocol::TProtocol>& inputProtocol,
const boost::shared_ptr<apache::thrift::protocol::TProtocol>& outputProtocol,
const boost::shared_ptr<apache::thrift::server::TServerEventHandler>& eventHandler,
const boost::shared_ptr<apache::thrift::transport::TTransport>& client);
const stdcxx::shared_ptr<apache::thrift::TProcessor>& processor,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocol>& inputProtocol,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocol>& outputProtocol,
const stdcxx::shared_ptr<apache::thrift::server::TServerEventHandler>& eventHandler,
const stdcxx::shared_ptr<apache::thrift::transport::TTransport>& client);
/**
* Destructor.
@@ -92,11 +92,11 @@ protected:
virtual void cleanup();
private:
boost::shared_ptr<apache::thrift::TProcessor> processor_;
boost::shared_ptr<apache::thrift::protocol::TProtocol> inputProtocol_;
boost::shared_ptr<apache::thrift::protocol::TProtocol> outputProtocol_;
boost::shared_ptr<apache::thrift::server::TServerEventHandler> eventHandler_;
boost::shared_ptr<apache::thrift::transport::TTransport> client_;
stdcxx::shared_ptr<apache::thrift::TProcessor> processor_;
stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> inputProtocol_;
stdcxx::shared_ptr<apache::thrift::protocol::TProtocol> outputProtocol_;
stdcxx::shared_ptr<apache::thrift::server::TServerEventHandler> eventHandler_;
stdcxx::shared_ptr<apache::thrift::transport::TTransport> client_;
/**
* Context acquired from the eventHandler_ if one exists.

View File

@@ -25,6 +25,7 @@
#include <thrift/concurrency/PlatformThreadFactory.h>
#include <thrift/transport/PlatformSocket.h>
#include <algorithm>
#include <iostream>
#ifdef HAVE_SYS_SELECT_H
@@ -77,10 +78,9 @@ namespace server {
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;
using namespace apache::thrift::concurrency;
using namespace std;
using apache::thrift::transport::TSocket;
using apache::thrift::transport::TTransportException;
using boost::shared_ptr;
using stdcxx::shared_ptr;
/// Three states for sockets: recv frame size, recv data, and send mode
enum TSocketState { SOCKET_RECV_FRAMING, SOCKET_RECV, SOCKET_SEND };
@@ -115,10 +115,10 @@ private:
TNonblockingServer* server_;
/// TProcessor
boost::shared_ptr<TProcessor> processor_;
stdcxx::shared_ptr<TProcessor> processor_;
/// Object wrapping network socket
boost::shared_ptr<TSocket> tSocket_;
stdcxx::shared_ptr<TSocket> tSocket_;
/// Libevent object
struct event event_;
@@ -160,23 +160,23 @@ private:
int32_t callsForResize_;
/// Transport to read from
boost::shared_ptr<TMemoryBuffer> inputTransport_;
stdcxx::shared_ptr<TMemoryBuffer> inputTransport_;
/// Transport that processor writes to
boost::shared_ptr<TMemoryBuffer> outputTransport_;
stdcxx::shared_ptr<TMemoryBuffer> outputTransport_;
/// extra transport generated by transport factory (e.g. BufferedRouterTransport)
boost::shared_ptr<TTransport> factoryInputTransport_;
boost::shared_ptr<TTransport> factoryOutputTransport_;
stdcxx::shared_ptr<TTransport> factoryInputTransport_;
stdcxx::shared_ptr<TTransport> factoryOutputTransport_;
/// Protocol decoder
boost::shared_ptr<TProtocol> inputProtocol_;
stdcxx::shared_ptr<TProtocol> inputProtocol_;
/// Protocol encoder
boost::shared_ptr<TProtocol> outputProtocol_;
stdcxx::shared_ptr<TProtocol> outputProtocol_;
/// Server event handler, if any
boost::shared_ptr<TServerEventHandler> serverEventHandler_;
stdcxx::shared_ptr<TServerEventHandler> serverEventHandler_;
/// Thrift call context, if any
void* connectionContext_;
@@ -209,10 +209,8 @@ public:
class Task;
/// Constructor
TConnection(THRIFT_SOCKET socket,
TNonblockingIOThread* ioThread,
const sockaddr* addr,
socklen_t addrLen) {
TConnection(stdcxx::shared_ptr<TSocket> socket,
TNonblockingIOThread* ioThread) {
readBuffer_ = NULL;
readBufferSize_ = 0;
@@ -224,8 +222,10 @@ public:
inputTransport_.reset(new TMemoryBuffer(readBuffer_, readBufferSize_));
outputTransport_.reset(
new TMemoryBuffer(static_cast<uint32_t>(server_->getWriteBufferDefaultSize())));
tSocket_.reset(new TSocket());
init(socket, ioThread, addr, addrLen);
tSocket_ = socket;
init(ioThread);
}
~TConnection() { std::free(readBuffer_); }
@@ -242,10 +242,10 @@ public:
void checkIdleBufferMemLimit(size_t readLimit, size_t writeLimit);
/// Initialize
void init(THRIFT_SOCKET socket,
TNonblockingIOThread* ioThread,
const sockaddr* addr,
socklen_t addrLen);
void init(TNonblockingIOThread* ioThread);
/// set socket for connection
void setSocket(stdcxx::shared_ptr<TSocket> socket);
/**
* This is called when the application transitions from one state into
@@ -301,10 +301,10 @@ public:
TAppState getState() const { return appState_; }
/// return the TSocket transport wrapping this network connection
boost::shared_ptr<TSocket> getTSocket() const { return tSocket_; }
stdcxx::shared_ptr<TSocket> getTSocket() const { return tSocket_; }
/// return the server event handler if any
boost::shared_ptr<TServerEventHandler> getServerEventHandler() { return serverEventHandler_; }
stdcxx::shared_ptr<TServerEventHandler> getServerEventHandler() { return serverEventHandler_; }
/// return the Thrift connection context if any
void* getConnectionContext() { return connectionContext_; }
@@ -312,9 +312,9 @@ public:
class TNonblockingServer::TConnection::Task : public Runnable {
public:
Task(boost::shared_ptr<TProcessor> processor,
boost::shared_ptr<TProtocol> input,
boost::shared_ptr<TProtocol> output,
Task(stdcxx::shared_ptr<TProcessor> processor,
stdcxx::shared_ptr<TProtocol> input,
stdcxx::shared_ptr<TProtocol> output,
TConnection* connection)
: processor_(processor),
input_(input),
@@ -336,7 +336,7 @@ public:
}
} catch (const TTransportException& ttx) {
GlobalOutput.printf("TNonblockingServer: client died: %s", ttx.what());
} catch (const bad_alloc&) {
} catch (const std::bad_alloc&) {
GlobalOutput("TNonblockingServer: caught bad_alloc exception.");
exit(1);
} catch (const std::exception& x) {
@@ -359,21 +359,15 @@ public:
TConnection* getTConnection() { return connection_; }
private:
boost::shared_ptr<TProcessor> processor_;
boost::shared_ptr<TProtocol> input_;
boost::shared_ptr<TProtocol> output_;
stdcxx::shared_ptr<TProcessor> processor_;
stdcxx::shared_ptr<TProtocol> input_;
stdcxx::shared_ptr<TProtocol> output_;
TConnection* connection_;
boost::shared_ptr<TServerEventHandler> serverEventHandler_;
stdcxx::shared_ptr<TServerEventHandler> serverEventHandler_;
void* connectionContext_;
};
void TNonblockingServer::TConnection::init(THRIFT_SOCKET socket,
TNonblockingIOThread* ioThread,
const sockaddr* addr,
socklen_t addrLen) {
tSocket_->setSocketFD(socket);
tSocket_->setCachedAddress(addr, addrLen);
void TNonblockingServer::TConnection::init(TNonblockingIOThread* ioThread) {
ioThread_ = ioThread;
server_ = ioThread->getServer();
appState_ = APP_INIT;
@@ -416,6 +410,10 @@ void TNonblockingServer::TConnection::init(THRIFT_SOCKET socket,
processor_ = server_->getProcessor(inputProtocol_, outputProtocol_, tSocket_);
}
void TNonblockingServer::TConnection::setSocket(stdcxx::shared_ptr<TSocket> socket) {
tSocket_ = socket;
}
void TNonblockingServer::TConnection::workSocket() {
int got = 0, left = 0, sent = 0;
uint32_t fetch = 0;
@@ -441,10 +439,14 @@ void TNonblockingServer::TConnection::workSocket() {
}
readBufferPos_ += fetch;
} catch (TTransportException& te) {
GlobalOutput.printf("TConnection::workSocket(): %s", te.what());
close();
//In Nonblocking SSLSocket some operations need to be retried again.
//Current approach is parsing exception message, but a better solution needs to be investigated.
if(!strstr(te.what(), "retry")) {
GlobalOutput.printf("TConnection::workSocket(): %s", te.what());
close();
return;
return;
}
}
if (readBufferPos_ < sizeof(framing.size)) {
@@ -481,8 +483,12 @@ void TNonblockingServer::TConnection::workSocket() {
fetch = readWant_ - readBufferPos_;
got = tSocket_->read(readBuffer_ + readBufferPos_, fetch);
} catch (TTransportException& te) {
GlobalOutput.printf("TConnection::workSocket(): %s", te.what());
close();
//In Nonblocking SSLSocket some operations need to be retried again.
//Current approach is parsing exception message, but a better solution needs to be investigated.
if(!strstr(te.what(), "retry")) {
GlobalOutput.printf("TConnection::workSocket(): %s", te.what());
close();
}
return;
}
@@ -588,7 +594,7 @@ void TNonblockingServer::TConnection::transition() {
// We are setting up a Task to do this work and we will wait on it
// Create task and dispatch to the thread manager
boost::shared_ptr<Runnable> task = boost::shared_ptr<Runnable>(
stdcxx::shared_ptr<Runnable> task = stdcxx::shared_ptr<Runnable>(
new Task(processor_, inputProtocol_, outputProtocol_, this));
// The application is now waiting on the task to finish
appState_ = APP_WAIT_TASK;
@@ -748,7 +754,7 @@ void TNonblockingServer::TConnection::transition() {
appState_ = APP_READ_REQUEST;
// Work the socket right away
// workSocket();
workSocket();
return;
@@ -873,9 +879,9 @@ TNonblockingServer::~TNonblockingServer() {
// objects and the Thread objects have shared_ptrs to the TNonblockingIOThread
// objects (as runnable) so these objects will never deallocate without help.
while (!ioThreads_.empty()) {
boost::shared_ptr<TNonblockingIOThread> iot = ioThreads_.back();
stdcxx::shared_ptr<TNonblockingIOThread> iot = ioThreads_.back();
ioThreads_.pop_back();
iot->setThread(boost::shared_ptr<Thread>());
iot->setThread(stdcxx::shared_ptr<Thread>());
}
}
@@ -883,9 +889,7 @@ TNonblockingServer::~TNonblockingServer() {
* Creates a new connection either by reusing an object off the stack or
* by allocating a new one entirely
*/
TNonblockingServer::TConnection* TNonblockingServer::createConnection(THRIFT_SOCKET socket,
const sockaddr* addr,
socklen_t addrLen) {
TNonblockingServer::TConnection* TNonblockingServer::createConnection(stdcxx::shared_ptr<TSocket> socket) {
// Check the stack
Guard g(connMutex_);
@@ -899,12 +903,13 @@ TNonblockingServer::TConnection* TNonblockingServer::createConnection(THRIFT_SOC
// Check the connection stack to see if we can re-use
TConnection* result = NULL;
if (connectionStack_.empty()) {
result = new TConnection(socket, ioThread, addr, addrLen);
result = new TConnection(socket, ioThread);
++numTConnections_;
} else {
result = connectionStack_.top();
connectionStack_.pop();
result->init(socket, ioThread, addr, addrLen);
result->setSocket(socket);
result->init(ioThread);
}
activeConnections_.push_back(result);
return result;
@@ -939,53 +944,35 @@ void TNonblockingServer::handleEvent(THRIFT_SOCKET fd, short which) {
// Make sure that libevent didn't mess up the socket handles
assert(fd == serverSocket_);
// Server socket accepted a new connection
socklen_t addrLen;
sockaddr_storage addrStorage;
sockaddr* addrp = (sockaddr*)&addrStorage;
addrLen = sizeof(addrStorage);
// Going to accept a new client socket
THRIFT_SOCKET clientSocket;
stdcxx::shared_ptr<TSocket> clientSocket;
// Accept as many new clients as possible, even though libevent signaled only
// one, this helps us to avoid having to go back into the libevent engine so
// many times
while ((clientSocket = ::accept(fd, addrp, &addrLen)) != -1) {
clientSocket = serverTransport_->accept();
if (clientSocket) {
// If we're overloaded, take action here
if (overloadAction_ != T_OVERLOAD_NO_ACTION && serverOverloaded()) {
Guard g(connMutex_);
nConnectionsDropped_++;
nTotalConnectionsDropped_++;
if (overloadAction_ == T_OVERLOAD_CLOSE_ON_ACCEPT) {
::THRIFT_CLOSESOCKET(clientSocket);
clientSocket->close();
return;
} else if (overloadAction_ == T_OVERLOAD_DRAIN_TASK_QUEUE) {
if (!drainPendingTask()) {
// Nothing left to discard, so we drop connection instead.
::THRIFT_CLOSESOCKET(clientSocket);
clientSocket->close();
return;
}
}
}
// Explicitly set this socket to NONBLOCK mode
int flags;
if ((flags = THRIFT_FCNTL(clientSocket, THRIFT_F_GETFL, 0)) < 0
|| THRIFT_FCNTL(clientSocket, THRIFT_F_SETFL, flags | THRIFT_O_NONBLOCK) < 0) {
GlobalOutput.perror("thriftServerEventHandler: set THRIFT_O_NONBLOCK (THRIFT_FCNTL) ",
THRIFT_GET_SOCKET_ERROR);
::THRIFT_CLOSESOCKET(clientSocket);
return;
}
// Create a new TConnection for this client socket.
TConnection* clientConnection = createConnection(clientSocket, addrp, addrLen);
TConnection* clientConnection = createConnection(clientSocket);
// Fail fast if we could not create a TConnection object
if (clientConnection == NULL) {
GlobalOutput.printf("thriftServerEventHandler: failed TConnection factory");
::THRIFT_CLOSESOCKET(clientSocket);
clientSocket->close();
return;
}
@@ -1009,15 +996,6 @@ void TNonblockingServer::handleEvent(THRIFT_SOCKET fd, short which) {
clientConnection->close();
}
}
// addrLen is written by the accept() call, so needs to be set before the next call.
addrLen = sizeof(addrStorage);
}
// Done looping accept, now we have to make sure the error is due to
// blocking. Any other error is a problem
if (THRIFT_GET_SOCKET_ERROR != THRIFT_EAGAIN && THRIFT_GET_SOCKET_ERROR != THRIFT_EWOULDBLOCK) {
GlobalOutput.perror("thriftServerEventHandler: accept() ", THRIFT_GET_SOCKET_ERROR);
}
}
@@ -1025,132 +1003,12 @@ void TNonblockingServer::handleEvent(THRIFT_SOCKET fd, short which) {
* Creates a socket to listen on and binds it to the local port.
*/
void TNonblockingServer::createAndListenOnSocket() {
#ifdef _WIN32
TWinsockSingleton::create();
#endif // _WIN32
THRIFT_SOCKET s;
struct addrinfo hints, *res, *res0;
int error;
char port[sizeof("65536") + 1];
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
sprintf(port, "%d", port_);
// Wildcard address
error = getaddrinfo(NULL, port, &hints, &res0);
if (error) {
throw TException("TNonblockingServer::serve() getaddrinfo "
+ string(THRIFT_GAI_STRERROR(error)));
}
// Pick the ipv6 address first since ipv4 addresses can be mapped
// into ipv6 space.
for (res = res0; res; res = res->ai_next) {
if (res->ai_family == AF_INET6 || res->ai_next == NULL)
break;
}
// Create the server socket
s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (s == -1) {
freeaddrinfo(res0);
throw TException("TNonblockingServer::serve() socket() -1");
}
#ifdef IPV6_V6ONLY
if (res->ai_family == AF_INET6) {
int zero = 0;
if (-1 == setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, const_cast_sockopt(&zero), sizeof(zero))) {
GlobalOutput.perror("TServerSocket::listen() IPV6_V6ONLY", THRIFT_GET_SOCKET_ERROR);
}
}
#endif // #ifdef IPV6_V6ONLY
int one = 1;
// Set THRIFT_NO_SOCKET_CACHING to avoid 2MSL delay on server restart
setsockopt(s, SOL_SOCKET, THRIFT_NO_SOCKET_CACHING, const_cast_sockopt(&one), sizeof(one));
if (::bind(s, res->ai_addr, static_cast<int>(res->ai_addrlen)) == -1) {
::THRIFT_CLOSESOCKET(s);
freeaddrinfo(res0);
throw TTransportException(TTransportException::NOT_OPEN,
"TNonblockingServer::serve() bind",
THRIFT_GET_SOCKET_ERROR);
}
// Done with the addr info
freeaddrinfo(res0);
// Set up this file descriptor for listening
listenSocket(s);
serverTransport_->listen();
serverSocket_ = serverTransport_->getSocketFD();
}
/**
* Takes a socket created by listenSocket() and sets various options on it
* to prepare for use in the server.
*/
void TNonblockingServer::listenSocket(THRIFT_SOCKET s) {
// Set socket to nonblocking mode
int flags;
if ((flags = THRIFT_FCNTL(s, THRIFT_F_GETFL, 0)) < 0
|| THRIFT_FCNTL(s, THRIFT_F_SETFL, flags | THRIFT_O_NONBLOCK) < 0) {
::THRIFT_CLOSESOCKET(s);
throw TException("TNonblockingServer::serve() THRIFT_O_NONBLOCK");
}
int one = 1;
struct linger ling = {0, 0};
// Keepalive to ensure full result flushing
setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, const_cast_sockopt(&one), sizeof(one));
// Turn linger off to avoid hung sockets
setsockopt(s, SOL_SOCKET, SO_LINGER, const_cast_sockopt(&ling), sizeof(ling));
// Set TCP nodelay if available, MAC OS X Hack
// See http://lists.danga.com/pipermail/memcached/2005-March/001240.html
#ifndef TCP_NOPUSH
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, const_cast_sockopt(&one), sizeof(one));
#endif
#ifdef TCP_LOW_MIN_RTO
if (TSocket::getUseLowMinRto()) {
setsockopt(s, IPPROTO_TCP, TCP_LOW_MIN_RTO, const_cast_sockopt(&one), sizeof(one));
}
#endif
if (listen(s, LISTEN_BACKLOG) == -1) {
::THRIFT_CLOSESOCKET(s);
throw TTransportException(TTransportException::NOT_OPEN, "TNonblockingServer::serve() listen");
}
// Cool, this socket is good to go, set it as the serverSocket_
serverSocket_ = s;
if (!port_) {
struct sockaddr_storage addr;
socklen_t size = sizeof(addr);
if (!getsockname(serverSocket_, reinterpret_cast<sockaddr*>(&addr), &size)) {
if (addr.ss_family == AF_INET6) {
const struct sockaddr_in6* sin = reinterpret_cast<const struct sockaddr_in6*>(&addr);
listenPort_ = ntohs(sin->sin6_port);
} else {
const struct sockaddr_in* sin = reinterpret_cast<const struct sockaddr_in*>(&addr);
listenPort_ = ntohs(sin->sin_port);
}
} else {
GlobalOutput.perror("TNonblocking: failed to get listen port: ", THRIFT_GET_SOCKET_ERROR);
}
}
}
void TNonblockingServer::setThreadManager(boost::shared_ptr<ThreadManager> threadManager) {
void TNonblockingServer::setThreadManager(stdcxx::shared_ptr<ThreadManager> threadManager) {
threadManager_ = threadManager;
if (threadManager) {
threadManager->setExpireCallback(
@@ -1188,7 +1046,7 @@ bool TNonblockingServer::serverOverloaded() {
bool TNonblockingServer::drainPendingTask() {
if (threadManager_) {
boost::shared_ptr<Runnable> task = threadManager_->removeNextPending();
stdcxx::shared_ptr<Runnable> task = threadManager_->removeNextPending();
if (task) {
TConnection* connection = static_cast<TConnection::Task*>(task.get())->getTConnection();
assert(connection && connection->getServer() && connection->getState() == APP_WAIT_TASK);
@@ -1199,16 +1057,13 @@ bool TNonblockingServer::drainPendingTask() {
return false;
}
void TNonblockingServer::expireClose(boost::shared_ptr<Runnable> task) {
void TNonblockingServer::expireClose(stdcxx::shared_ptr<Runnable> task) {
TConnection* connection = static_cast<TConnection::Task*>(task.get())->getTConnection();
assert(connection && connection->getServer() && connection->getState() == APP_WAIT_TASK);
connection->forceClose();
}
void TNonblockingServer::stop() {
if (!port_) {
listenPort_ = 0;
}
void TNonblockingServer::stop() {
// Breaks the event loop in all threads so that they end ASAP.
for (uint32_t i = 0; i < ioThreads_.size(); ++i) {
ioThreads_[i]->stop();
@@ -1249,8 +1104,7 @@ void TNonblockingServer::registerEvents(event_base* user_event_base) {
assert(ioThreads_.size() == numIOThreads_);
assert(ioThreads_.size() > 0);
GlobalOutput.printf("TNonblockingServer: Serving on port %d, %d io threads.",
listenPort_,
GlobalOutput.printf("TNonblockingServer: Serving with %d io threads.",
ioThreads_.size());
// Launch all the secondary IO threads in separate threads

View File

@@ -21,10 +21,12 @@
#define _THRIFT_SERVER_TNONBLOCKINGSERVER_H_ 1
#include <thrift/Thrift.h>
#include <thrift/stdcxx.h>
#include <thrift/server/TServer.h>
#include <thrift/transport/PlatformSocket.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/transport/TSocket.h>
#include <thrift/transport/TNonblockingServerTransport.h>
#include <thrift/concurrency/ThreadManager.h>
#include <climits>
#include <thrift/concurrency/Thread.h>
@@ -47,6 +49,7 @@ namespace server {
using apache::thrift::transport::TMemoryBuffer;
using apache::thrift::transport::TSocket;
using apache::thrift::transport::TNonblockingServerTransport;
using apache::thrift::protocol::TProtocol;
using apache::thrift::concurrency::Runnable;
using apache::thrift::concurrency::ThreadManager;
@@ -96,10 +99,6 @@ inline SOCKOPT_CAST_T* cast_sockopt(T* v) {
* operates a set of IO threads (by default only one). It assumes that
* all incoming requests are framed with a 4 byte length indicator and
* writes out responses using the same framing.
*
* It does not use the TServerTransport framework, but rather has socket
* operations hardcoded for use with select.
*
*/
/// Overload condition actions.
@@ -157,26 +156,20 @@ private:
/// Server socket file descriptor
THRIFT_SOCKET serverSocket_;
/// Port server runs on. Zero when letting OS decide actual port
int port_;
/// Port server actually runs on
int listenPort_;
/// The optional user-provided event-base (for single-thread servers)
event_base* userEventBase_;
/// For processing via thread pool, may be NULL
boost::shared_ptr<ThreadManager> threadManager_;
stdcxx::shared_ptr<ThreadManager> threadManager_;
/// Is thread pool processing?
bool threadPoolProcessing_;
// Factory to create the IO threads
boost::shared_ptr<PlatformThreadFactory> ioThreadFactory_;
stdcxx::shared_ptr<PlatformThreadFactory> ioThreadFactory_;
// Vector of IOThread objects that will handle our IO
std::vector<boost::shared_ptr<TNonblockingIOThread> > ioThreads_;
std::vector<stdcxx::shared_ptr<TNonblockingIOThread> > ioThreads_;
// Index of next IO Thread to be used (for round-robin)
uint32_t nextIOThread_;
@@ -269,23 +262,24 @@ private:
*/
std::vector<TConnection*> activeConnections_;
/*
*/
stdcxx::shared_ptr<TNonblockingServerTransport> serverTransport_;
/**
* Called when server socket had something happen. We accept all waiting
* client connections on listen socket fd and assign TConnection objects
* to handle those requests.
*
* @param fd the listen socket.
* @param which the event flag that triggered the handler.
*/
void handleEvent(THRIFT_SOCKET fd, short which);
void init(int port) {
void init() {
serverSocket_ = THRIFT_INVALID_SOCKET;
numIOThreads_ = DEFAULT_IO_THREADS;
nextIOThread_ = 0;
useHighPriorityIOThreads_ = false;
port_ = port;
listenPort_ = port;
userEventBase_ = NULL;
threadPoolProcessing_ = false;
numTConnections_ = 0;
@@ -307,55 +301,55 @@ private:
}
public:
TNonblockingServer(const boost::shared_ptr<TProcessorFactory>& processorFactory, int port)
: TServer(processorFactory) {
init(port);
TNonblockingServer(const stdcxx::shared_ptr<TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TNonblockingServerTransport>& serverTransport)
: TServer(processorFactory), serverTransport_(serverTransport) {
init();
}
TNonblockingServer(const boost::shared_ptr<TProcessor>& processor, int port)
: TServer(processor) {
init(port);
TNonblockingServer(const stdcxx::shared_ptr<TProcessor>& processor,
const stdcxx::shared_ptr<apache::thrift::transport::TNonblockingServerTransport>& serverTransport)
: TServer(processor), serverTransport_(serverTransport) {
init();
}
TNonblockingServer(const boost::shared_ptr<TProcessorFactory>& processorFactory,
const boost::shared_ptr<TProtocolFactory>& protocolFactory,
int port,
const boost::shared_ptr<ThreadManager>& threadManager
= boost::shared_ptr<ThreadManager>())
: TServer(processorFactory) {
init(port);
TNonblockingServer(const stdcxx::shared_ptr<TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<TProtocolFactory>& protocolFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TNonblockingServerTransport>& serverTransport,
const stdcxx::shared_ptr<ThreadManager>& threadManager
= stdcxx::shared_ptr<ThreadManager>())
: TServer(processorFactory), serverTransport_(serverTransport) {
init();
setInputProtocolFactory(protocolFactory);
setOutputProtocolFactory(protocolFactory);
setThreadManager(threadManager);
}
TNonblockingServer(const boost::shared_ptr<TProcessor>& processor,
const boost::shared_ptr<TProtocolFactory>& protocolFactory,
int port,
const boost::shared_ptr<ThreadManager>& threadManager
= boost::shared_ptr<ThreadManager>())
: TServer(processor) {
init(port);
TNonblockingServer(const stdcxx::shared_ptr<TProcessor>& processor,
const stdcxx::shared_ptr<TProtocolFactory>& protocolFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TNonblockingServerTransport>& serverTransport,
const stdcxx::shared_ptr<ThreadManager>& threadManager
= stdcxx::shared_ptr<ThreadManager>())
: TServer(processor), serverTransport_(serverTransport) {
init();
setInputProtocolFactory(protocolFactory);
setOutputProtocolFactory(protocolFactory);
setThreadManager(threadManager);
}
TNonblockingServer(const boost::shared_ptr<TProcessorFactory>& processorFactory,
const boost::shared_ptr<TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<TProtocolFactory>& outputProtocolFactory,
int port,
const boost::shared_ptr<ThreadManager>& threadManager
= boost::shared_ptr<ThreadManager>())
: TServer(processorFactory) {
init(port);
TNonblockingServer(const stdcxx::shared_ptr<TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<TProtocolFactory>& outputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TNonblockingServerTransport>& serverTransport,
const stdcxx::shared_ptr<ThreadManager>& threadManager
= stdcxx::shared_ptr<ThreadManager>())
: TServer(processorFactory), serverTransport_(serverTransport) {
init();
setInputTransportFactory(inputTransportFactory);
setOutputTransportFactory(outputTransportFactory);
@@ -364,17 +358,16 @@ public:
setThreadManager(threadManager);
}
TNonblockingServer(const boost::shared_ptr<TProcessor>& processor,
const boost::shared_ptr<TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<TProtocolFactory>& outputProtocolFactory,
int port,
const boost::shared_ptr<ThreadManager>& threadManager
= boost::shared_ptr<ThreadManager>())
: TServer(processor) {
init(port);
TNonblockingServer(const stdcxx::shared_ptr<TProcessor>& processor,
const stdcxx::shared_ptr<TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<TProtocolFactory>& outputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TNonblockingServerTransport>& serverTransport,
const stdcxx::shared_ptr<ThreadManager>& threadManager
= stdcxx::shared_ptr<ThreadManager>())
: TServer(processor), serverTransport_(serverTransport) {
init();
setInputTransportFactory(inputTransportFactory);
setOutputTransportFactory(outputTransportFactory);
@@ -385,11 +378,11 @@ public:
~TNonblockingServer();
void setThreadManager(boost::shared_ptr<ThreadManager> threadManager);
void setThreadManager(stdcxx::shared_ptr<ThreadManager> threadManager);
int getListenPort() { return listenPort_; }
int getListenPort() { return serverTransport_->getListenPort(); }
boost::shared_ptr<ThreadManager> getThreadManager() { return threadManager_; }
stdcxx::shared_ptr<ThreadManager> getThreadManager() { return threadManager_; }
/**
* Sets the number of IO threads used by this server. Can only be used before
@@ -428,7 +421,7 @@ public:
bool isThreadPoolProcessing() const { return threadPoolProcessing_; }
void addTask(boost::shared_ptr<Runnable> task) {
void addTask(stdcxx::shared_ptr<Runnable> task) {
threadManager_->add(task, 0LL, taskExpireTime_);
}
@@ -688,14 +681,6 @@ public:
/// Creates a socket to listen on and binds it to the local port.
void createAndListenOnSocket();
/**
* Takes a socket created by createAndListenOnSocket() and sets various
* options on it to prepare for use in the server.
*
* @param fd descriptor of socket to be initialized/
*/
void listenSocket(THRIFT_SOCKET fd);
/**
* Register the optional user-provided event-base (for single-thread servers)
*
@@ -724,7 +709,7 @@ private:
*
* @param task the runnable associated with the expired task.
*/
void expireClose(boost::shared_ptr<Runnable> task);
void expireClose(stdcxx::shared_ptr<Runnable> task);
/**
* Return an initialized connection object. Creates or recovers from
@@ -736,7 +721,7 @@ private:
* @param addrLen the length of addr
* @return pointer to initialized TConnection object.
*/
TConnection* createConnection(THRIFT_SOCKET socket, const sockaddr* addr, socklen_t addrLen);
TConnection* createConnection(stdcxx::shared_ptr<TSocket> socket);
/**
* Returns a connection to pool or deletion. If the connection pool
@@ -780,10 +765,10 @@ public:
evutil_socket_t getNotificationRecvFD() const { return notificationPipeFDs_[0]; }
// Returns the actual thread object associated with this IO thread.
boost::shared_ptr<Thread> getThread() const { return thread_; }
stdcxx::shared_ptr<Thread> getThread() const { return thread_; }
// Sets the actual thread object associated with this IO thread.
void setThread(const boost::shared_ptr<Thread>& t) { thread_ = t; }
void setThread(const stdcxx::shared_ptr<Thread>& t) { thread_ = t; }
// Used by TConnection objects to indicate processing has finished.
bool notify(TNonblockingServer::TConnection* conn);
@@ -868,7 +853,7 @@ private:
evutil_socket_t notificationPipeFDs_[2];
/// Actual IO Thread
boost::shared_ptr<Thread> thread_;
stdcxx::shared_ptr<Thread> thread_;
};
}
}

View File

@@ -25,7 +25,7 @@
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/concurrency/Thread.h>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
namespace apache {
namespace thrift {
@@ -58,8 +58,8 @@ public:
/**
* Called when a new client has connected and is about to being processing.
*/
virtual void* createContext(boost::shared_ptr<TProtocol> input,
boost::shared_ptr<TProtocol> output) {
virtual void* createContext(stdcxx::shared_ptr<TProtocol> input,
stdcxx::shared_ptr<TProtocol> output) {
(void)input;
(void)output;
return NULL;
@@ -70,8 +70,8 @@ public:
* context.
*/
virtual void deleteContext(void* serverContext,
boost::shared_ptr<TProtocol> input,
boost::shared_ptr<TProtocol> output) {
stdcxx::shared_ptr<TProtocol> input,
stdcxx::shared_ptr<TProtocol> output) {
(void)serverContext;
(void)input;
(void)output;
@@ -80,7 +80,7 @@ public:
/**
* Called when a client is about to call the processor.
*/
virtual void processContext(void* serverContext, boost::shared_ptr<TTransport> transport) {
virtual void processContext(void* serverContext, stdcxx::shared_ptr<TTransport> transport) {
(void)serverContext;
(void)transport;
}
@@ -107,62 +107,62 @@ public:
// Allows running the server as a Runnable thread
virtual void run() { serve(); }
boost::shared_ptr<TProcessorFactory> getProcessorFactory() { return processorFactory_; }
stdcxx::shared_ptr<TProcessorFactory> getProcessorFactory() { return processorFactory_; }
boost::shared_ptr<TServerTransport> getServerTransport() { return serverTransport_; }
stdcxx::shared_ptr<TServerTransport> getServerTransport() { return serverTransport_; }
boost::shared_ptr<TTransportFactory> getInputTransportFactory() { return inputTransportFactory_; }
stdcxx::shared_ptr<TTransportFactory> getInputTransportFactory() { return inputTransportFactory_; }
boost::shared_ptr<TTransportFactory> getOutputTransportFactory() {
stdcxx::shared_ptr<TTransportFactory> getOutputTransportFactory() {
return outputTransportFactory_;
}
boost::shared_ptr<TProtocolFactory> getInputProtocolFactory() { return inputProtocolFactory_; }
stdcxx::shared_ptr<TProtocolFactory> getInputProtocolFactory() { return inputProtocolFactory_; }
boost::shared_ptr<TProtocolFactory> getOutputProtocolFactory() { return outputProtocolFactory_; }
stdcxx::shared_ptr<TProtocolFactory> getOutputProtocolFactory() { return outputProtocolFactory_; }
boost::shared_ptr<TServerEventHandler> getEventHandler() { return eventHandler_; }
stdcxx::shared_ptr<TServerEventHandler> getEventHandler() { return eventHandler_; }
protected:
TServer(const boost::shared_ptr<TProcessorFactory>& processorFactory)
TServer(const stdcxx::shared_ptr<TProcessorFactory>& processorFactory)
: processorFactory_(processorFactory) {
setInputTransportFactory(boost::shared_ptr<TTransportFactory>(new TTransportFactory()));
setOutputTransportFactory(boost::shared_ptr<TTransportFactory>(new TTransportFactory()));
setInputProtocolFactory(boost::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setOutputProtocolFactory(boost::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setInputTransportFactory(stdcxx::shared_ptr<TTransportFactory>(new TTransportFactory()));
setOutputTransportFactory(stdcxx::shared_ptr<TTransportFactory>(new TTransportFactory()));
setInputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setOutputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
}
TServer(const boost::shared_ptr<TProcessor>& processor)
TServer(const stdcxx::shared_ptr<TProcessor>& processor)
: processorFactory_(new TSingletonProcessorFactory(processor)) {
setInputTransportFactory(boost::shared_ptr<TTransportFactory>(new TTransportFactory()));
setOutputTransportFactory(boost::shared_ptr<TTransportFactory>(new TTransportFactory()));
setInputProtocolFactory(boost::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setOutputProtocolFactory(boost::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setInputTransportFactory(stdcxx::shared_ptr<TTransportFactory>(new TTransportFactory()));
setOutputTransportFactory(stdcxx::shared_ptr<TTransportFactory>(new TTransportFactory()));
setInputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setOutputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
}
TServer(const boost::shared_ptr<TProcessorFactory>& processorFactory,
const boost::shared_ptr<TServerTransport>& serverTransport)
TServer(const stdcxx::shared_ptr<TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<TServerTransport>& serverTransport)
: processorFactory_(processorFactory), serverTransport_(serverTransport) {
setInputTransportFactory(boost::shared_ptr<TTransportFactory>(new TTransportFactory()));
setOutputTransportFactory(boost::shared_ptr<TTransportFactory>(new TTransportFactory()));
setInputProtocolFactory(boost::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setOutputProtocolFactory(boost::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setInputTransportFactory(stdcxx::shared_ptr<TTransportFactory>(new TTransportFactory()));
setOutputTransportFactory(stdcxx::shared_ptr<TTransportFactory>(new TTransportFactory()));
setInputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setOutputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
}
TServer(const boost::shared_ptr<TProcessor>& processor,
const boost::shared_ptr<TServerTransport>& serverTransport)
TServer(const stdcxx::shared_ptr<TProcessor>& processor,
const stdcxx::shared_ptr<TServerTransport>& serverTransport)
: processorFactory_(new TSingletonProcessorFactory(processor)),
serverTransport_(serverTransport) {
setInputTransportFactory(boost::shared_ptr<TTransportFactory>(new TTransportFactory()));
setOutputTransportFactory(boost::shared_ptr<TTransportFactory>(new TTransportFactory()));
setInputProtocolFactory(boost::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setOutputProtocolFactory(boost::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setInputTransportFactory(stdcxx::shared_ptr<TTransportFactory>(new TTransportFactory()));
setOutputTransportFactory(stdcxx::shared_ptr<TTransportFactory>(new TTransportFactory()));
setInputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
setOutputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory()));
}
TServer(const boost::shared_ptr<TProcessorFactory>& processorFactory,
const boost::shared_ptr<TServerTransport>& serverTransport,
const boost::shared_ptr<TTransportFactory>& transportFactory,
const boost::shared_ptr<TProtocolFactory>& protocolFactory)
TServer(const stdcxx::shared_ptr<TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<TServerTransport>& serverTransport,
const stdcxx::shared_ptr<TTransportFactory>& transportFactory,
const stdcxx::shared_ptr<TProtocolFactory>& protocolFactory)
: processorFactory_(processorFactory),
serverTransport_(serverTransport),
inputTransportFactory_(transportFactory),
@@ -170,10 +170,10 @@ protected:
inputProtocolFactory_(protocolFactory),
outputProtocolFactory_(protocolFactory) {}
TServer(const boost::shared_ptr<TProcessor>& processor,
const boost::shared_ptr<TServerTransport>& serverTransport,
const boost::shared_ptr<TTransportFactory>& transportFactory,
const boost::shared_ptr<TProtocolFactory>& protocolFactory)
TServer(const stdcxx::shared_ptr<TProcessor>& processor,
const stdcxx::shared_ptr<TServerTransport>& serverTransport,
const stdcxx::shared_ptr<TTransportFactory>& transportFactory,
const stdcxx::shared_ptr<TProtocolFactory>& protocolFactory)
: processorFactory_(new TSingletonProcessorFactory(processor)),
serverTransport_(serverTransport),
inputTransportFactory_(transportFactory),
@@ -181,12 +181,12 @@ protected:
inputProtocolFactory_(protocolFactory),
outputProtocolFactory_(protocolFactory) {}
TServer(const boost::shared_ptr<TProcessorFactory>& processorFactory,
const boost::shared_ptr<TServerTransport>& serverTransport,
const boost::shared_ptr<TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<TProtocolFactory>& outputProtocolFactory)
TServer(const stdcxx::shared_ptr<TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<TServerTransport>& serverTransport,
const stdcxx::shared_ptr<TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<TProtocolFactory>& outputProtocolFactory)
: processorFactory_(processorFactory),
serverTransport_(serverTransport),
inputTransportFactory_(inputTransportFactory),
@@ -194,12 +194,12 @@ protected:
inputProtocolFactory_(inputProtocolFactory),
outputProtocolFactory_(outputProtocolFactory) {}
TServer(const boost::shared_ptr<TProcessor>& processor,
const boost::shared_ptr<TServerTransport>& serverTransport,
const boost::shared_ptr<TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<TProtocolFactory>& outputProtocolFactory)
TServer(const stdcxx::shared_ptr<TProcessor>& processor,
const stdcxx::shared_ptr<TServerTransport>& serverTransport,
const stdcxx::shared_ptr<TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<TProtocolFactory>& outputProtocolFactory)
: processorFactory_(new TSingletonProcessorFactory(processor)),
serverTransport_(serverTransport),
inputTransportFactory_(inputTransportFactory),
@@ -214,9 +214,9 @@ protected:
* call). This allows the TProcessorFactory to return a different processor
* for each connection if it desires.
*/
boost::shared_ptr<TProcessor> getProcessor(boost::shared_ptr<TProtocol> inputProtocol,
boost::shared_ptr<TProtocol> outputProtocol,
boost::shared_ptr<TTransport> transport) {
stdcxx::shared_ptr<TProcessor> getProcessor(stdcxx::shared_ptr<TProtocol> inputProtocol,
stdcxx::shared_ptr<TProtocol> outputProtocol,
stdcxx::shared_ptr<TTransport> transport) {
TConnectionInfo connInfo;
connInfo.input = inputProtocol;
connInfo.output = outputProtocol;
@@ -225,35 +225,35 @@ protected:
}
// Class variables
boost::shared_ptr<TProcessorFactory> processorFactory_;
boost::shared_ptr<TServerTransport> serverTransport_;
stdcxx::shared_ptr<TProcessorFactory> processorFactory_;
stdcxx::shared_ptr<TServerTransport> serverTransport_;
boost::shared_ptr<TTransportFactory> inputTransportFactory_;
boost::shared_ptr<TTransportFactory> outputTransportFactory_;
stdcxx::shared_ptr<TTransportFactory> inputTransportFactory_;
stdcxx::shared_ptr<TTransportFactory> outputTransportFactory_;
boost::shared_ptr<TProtocolFactory> inputProtocolFactory_;
boost::shared_ptr<TProtocolFactory> outputProtocolFactory_;
stdcxx::shared_ptr<TProtocolFactory> inputProtocolFactory_;
stdcxx::shared_ptr<TProtocolFactory> outputProtocolFactory_;
boost::shared_ptr<TServerEventHandler> eventHandler_;
stdcxx::shared_ptr<TServerEventHandler> eventHandler_;
public:
void setInputTransportFactory(boost::shared_ptr<TTransportFactory> inputTransportFactory) {
void setInputTransportFactory(stdcxx::shared_ptr<TTransportFactory> inputTransportFactory) {
inputTransportFactory_ = inputTransportFactory;
}
void setOutputTransportFactory(boost::shared_ptr<TTransportFactory> outputTransportFactory) {
void setOutputTransportFactory(stdcxx::shared_ptr<TTransportFactory> outputTransportFactory) {
outputTransportFactory_ = outputTransportFactory;
}
void setInputProtocolFactory(boost::shared_ptr<TProtocolFactory> inputProtocolFactory) {
void setInputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory> inputProtocolFactory) {
inputProtocolFactory_ = inputProtocolFactory;
}
void setOutputProtocolFactory(boost::shared_ptr<TProtocolFactory> outputProtocolFactory) {
void setOutputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory> outputProtocolFactory) {
outputProtocolFactory_ = outputProtocolFactory;
}
void setServerEventHandler(boost::shared_ptr<TServerEventHandler> eventHandler) {
void setServerEventHandler(stdcxx::shared_ptr<TServerEventHandler> eventHandler) {
eventHandler_ = eventHandler;
}
};

View File

@@ -18,7 +18,6 @@
*/
#include <algorithm>
#include <boost/bind.hpp>
#include <stdexcept>
#include <stdint.h>
#include <thrift/server/TServerFramework.h>
@@ -28,14 +27,14 @@ namespace thrift {
namespace server {
using apache::thrift::concurrency::Synchronized;
using apache::thrift::protocol::TProtocol;
using apache::thrift::protocol::TProtocolFactory;
using apache::thrift::stdcxx::bind;
using apache::thrift::stdcxx::shared_ptr;
using apache::thrift::transport::TServerTransport;
using apache::thrift::transport::TTransport;
using apache::thrift::transport::TTransportException;
using apache::thrift::transport::TTransportFactory;
using apache::thrift::protocol::TProtocol;
using apache::thrift::protocol::TProtocolFactory;
using boost::bind;
using boost::shared_ptr;
using std::string;
TServerFramework::TServerFramework(const shared_ptr<TProcessorFactory>& processorFactory,
@@ -162,7 +161,7 @@ void TServerFramework::serve() {
outputProtocol,
eventHandler_,
client),
bind(&TServerFramework::disposeConnectedClient, this, _1)));
bind(&TServerFramework::disposeConnectedClient, this, stdcxx::placeholders::_1)));
} catch (TTransportException& ttx) {
releaseOneDescriptor("inputTransport", inputTransport);
@@ -221,7 +220,7 @@ void TServerFramework::stop() {
serverTransport_->interrupt();
}
void TServerFramework::newlyConnectedClient(const boost::shared_ptr<TConnectedClient>& pClient) {
void TServerFramework::newlyConnectedClient(const shared_ptr<TConnectedClient>& pClient) {
{
Synchronized sync(mon_);
++clients_;

View File

@@ -20,7 +20,7 @@
#ifndef _THRIFT_SERVER_TSERVERFRAMEWORK_H_
#define _THRIFT_SERVER_TSERVERFRAMEWORK_H_ 1
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <stdint.h>
#include <thrift/TProcessor.h>
#include <thrift/concurrency/Monitor.h>
@@ -48,32 +48,32 @@ namespace server {
class TServerFramework : public TServer {
public:
TServerFramework(
const boost::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
const stdcxx::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
TServerFramework(
const boost::shared_ptr<apache::thrift::TProcessor>& processor,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
const stdcxx::shared_ptr<apache::thrift::TProcessor>& processor,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
TServerFramework(
const boost::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
const stdcxx::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
TServerFramework(
const boost::shared_ptr<apache::thrift::TProcessor>& processor,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
const stdcxx::shared_ptr<apache::thrift::TProcessor>& processor,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
virtual ~TServerFramework();
@@ -130,7 +130,7 @@ protected:
*
* \param[in] pClient the newly connected client
*/
virtual void onClientConnected(const boost::shared_ptr<TConnectedClient>& pClient) = 0;
virtual void onClientConnected(const stdcxx::shared_ptr<TConnectedClient>& pClient) = 0;
/**
* A client has disconnected.
@@ -149,7 +149,7 @@ private:
* client rate limiting after onClientConnected returns by blocking the
* serve() thread if the limit has been reached.
*/
void newlyConnectedClient(const boost::shared_ptr<TConnectedClient>& pClient);
void newlyConnectedClient(const stdcxx::shared_ptr<TConnectedClient>& pClient);
/**
* Smart pointer client deletion.

View File

@@ -29,7 +29,7 @@ using apache::thrift::transport::TServerTransport;
using apache::thrift::transport::TTransport;
using apache::thrift::transport::TTransportException;
using apache::thrift::transport::TTransportFactory;
using boost::shared_ptr;
using stdcxx::shared_ptr;
using std::string;
TSimpleServer::TSimpleServer(const shared_ptr<TProcessorFactory>& processorFactory,

View File

@@ -34,37 +34,37 @@ namespace server {
class TSimpleServer : public TServerFramework {
public:
TSimpleServer(
const boost::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
const stdcxx::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
TSimpleServer(
const boost::shared_ptr<apache::thrift::TProcessor>& processor,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
const stdcxx::shared_ptr<apache::thrift::TProcessor>& processor,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory);
TSimpleServer(
const boost::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
const stdcxx::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
TSimpleServer(
const boost::shared_ptr<apache::thrift::TProcessor>& processor,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
const stdcxx::shared_ptr<apache::thrift::TProcessor>& processor,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
virtual ~TSimpleServer();
protected:
virtual void onClientConnected(const boost::shared_ptr<TConnectedClient>& pClient) /* override */;
virtual void onClientConnected(const stdcxx::shared_ptr<TConnectedClient>& pClient) /* override */;
virtual void onClientDisconnected(TConnectedClient* pClient) /* override */;
private:

View File

@@ -30,7 +30,7 @@ using apache::thrift::transport::TServerTransport;
using apache::thrift::transport::TTransport;
using apache::thrift::transport::TTransportException;
using apache::thrift::transport::TTransportFactory;
using boost::shared_ptr;
using stdcxx::shared_ptr;
using std::string;
TThreadPoolServer::TThreadPoolServer(const shared_ptr<TProcessorFactory>& processorFactory,
@@ -115,7 +115,7 @@ void TThreadPoolServer::setTaskExpiration(int64_t value) {
taskExpiration_ = value;
}
boost::shared_ptr<apache::thrift::concurrency::ThreadManager>
stdcxx::shared_ptr<apache::thrift::concurrency::ThreadManager>
TThreadPoolServer::getThreadManager() const {
return threadManager_;
}

View File

@@ -34,39 +34,39 @@ namespace server {
class TThreadPoolServer : public TServerFramework {
public:
TThreadPoolServer(
const boost::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory,
const boost::shared_ptr<apache::thrift::concurrency::ThreadManager>& threadManager
const stdcxx::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory,
const stdcxx::shared_ptr<apache::thrift::concurrency::ThreadManager>& threadManager
= apache::thrift::concurrency::ThreadManager::newSimpleThreadManager());
TThreadPoolServer(
const boost::shared_ptr<apache::thrift::TProcessor>& processor,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory,
const boost::shared_ptr<apache::thrift::concurrency::ThreadManager>& threadManager
const stdcxx::shared_ptr<apache::thrift::TProcessor>& processor,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory,
const stdcxx::shared_ptr<apache::thrift::concurrency::ThreadManager>& threadManager
= apache::thrift::concurrency::ThreadManager::newSimpleThreadManager());
TThreadPoolServer(
const boost::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory,
const boost::shared_ptr<apache::thrift::concurrency::ThreadManager>& threadManager
const stdcxx::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::concurrency::ThreadManager>& threadManager
= apache::thrift::concurrency::ThreadManager::newSimpleThreadManager());
TThreadPoolServer(
const boost::shared_ptr<apache::thrift::TProcessor>& processor,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory,
const boost::shared_ptr<apache::thrift::concurrency::ThreadManager>& threadManager
const stdcxx::shared_ptr<apache::thrift::TProcessor>& processor,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::concurrency::ThreadManager>& threadManager
= apache::thrift::concurrency::ThreadManager::newSimpleThreadManager());
virtual ~TThreadPoolServer();
@@ -83,13 +83,13 @@ public:
virtual int64_t getTaskExpiration() const;
virtual void setTaskExpiration(int64_t value);
virtual boost::shared_ptr<apache::thrift::concurrency::ThreadManager> getThreadManager() const;
virtual stdcxx::shared_ptr<apache::thrift::concurrency::ThreadManager> getThreadManager() const;
protected:
virtual void onClientConnected(const boost::shared_ptr<TConnectedClient>& pClient) /* override */;
virtual void onClientConnected(const stdcxx::shared_ptr<TConnectedClient>& pClient) /* override */;
virtual void onClientDisconnected(TConnectedClient* pClient) /* override */;
boost::shared_ptr<apache::thrift::concurrency::ThreadManager> threadManager_;
stdcxx::shared_ptr<apache::thrift::concurrency::ThreadManager> threadManager_;
boost::atomic<int64_t> timeout_;
boost::atomic<int64_t> taskExpiration_;
};

View File

@@ -17,11 +17,8 @@
* under the License.
*/
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
#include <string>
#include <thrift/stdcxx.h>
#include <thrift/concurrency/PlatformThreadFactory.h>
#include <thrift/server/TThreadedServer.h>
@@ -35,11 +32,12 @@ using apache::thrift::concurrency::Thread;
using apache::thrift::concurrency::ThreadFactory;
using apache::thrift::protocol::TProtocol;
using apache::thrift::protocol::TProtocolFactory;
using apache::thrift::stdcxx::make_shared;
using apache::thrift::stdcxx::shared_ptr;
using apache::thrift::transport::TServerTransport;
using apache::thrift::transport::TTransport;
using apache::thrift::transport::TTransportException;
using apache::thrift::transport::TTransportFactory;
using boost::shared_ptr;
TThreadedServer::TThreadedServer(const shared_ptr<TProcessorFactory>& processorFactory,
const shared_ptr<TServerTransport>& serverTransport,
@@ -117,8 +115,8 @@ void TThreadedServer::drainDeadClients() {
void TThreadedServer::onClientConnected(const shared_ptr<TConnectedClient>& pClient) {
Synchronized sync(clientMonitor_);
boost::shared_ptr<TConnectedClientRunner> pRunnable = boost::make_shared<TConnectedClientRunner>(pClient);
boost::shared_ptr<Thread> pThread = threadFactory_->newThread(pRunnable);
shared_ptr<TConnectedClientRunner> pRunnable = make_shared<TConnectedClientRunner>(pClient);
shared_ptr<Thread> pThread = threadFactory_->newThread(pRunnable);
pRunnable->thread(pThread);
activeClientMap_.insert(ClientMap::value_type(pClient.get(), pThread));
pThread->start();
@@ -136,7 +134,7 @@ void TThreadedServer::onClientDisconnected(TConnectedClient* pClient) {
}
}
TThreadedServer::TConnectedClientRunner::TConnectedClientRunner(const boost::shared_ptr<TConnectedClient>& pClient)
TThreadedServer::TConnectedClientRunner::TConnectedClientRunner(const shared_ptr<TConnectedClient>& pClient)
: pClient_(pClient) {
}

View File

@@ -38,43 +38,43 @@ namespace server {
class TThreadedServer : public TServerFramework {
public:
TThreadedServer(
const boost::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory,
const boost::shared_ptr<apache::thrift::concurrency::ThreadFactory>& threadFactory
= boost::shared_ptr<apache::thrift::concurrency::ThreadFactory>(
const stdcxx::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory,
const stdcxx::shared_ptr<apache::thrift::concurrency::ThreadFactory>& threadFactory
= stdcxx::shared_ptr<apache::thrift::concurrency::ThreadFactory>(
new apache::thrift::concurrency::PlatformThreadFactory(false)));
TThreadedServer(
const boost::shared_ptr<apache::thrift::TProcessor>& processor,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory,
const boost::shared_ptr<apache::thrift::concurrency::ThreadFactory>& threadFactory
= boost::shared_ptr<apache::thrift::concurrency::ThreadFactory>(
const stdcxx::shared_ptr<apache::thrift::TProcessor>& processor,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& transportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& protocolFactory,
const stdcxx::shared_ptr<apache::thrift::concurrency::ThreadFactory>& threadFactory
= stdcxx::shared_ptr<apache::thrift::concurrency::ThreadFactory>(
new apache::thrift::concurrency::PlatformThreadFactory(false)));
TThreadedServer(
const boost::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory,
const boost::shared_ptr<apache::thrift::concurrency::ThreadFactory>& threadFactory
= boost::shared_ptr<apache::thrift::concurrency::ThreadFactory>(
const stdcxx::shared_ptr<apache::thrift::TProcessorFactory>& processorFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::concurrency::ThreadFactory>& threadFactory
= stdcxx::shared_ptr<apache::thrift::concurrency::ThreadFactory>(
new apache::thrift::concurrency::PlatformThreadFactory(false)));
TThreadedServer(
const boost::shared_ptr<apache::thrift::TProcessor>& processor,
const boost::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const boost::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const boost::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory,
const boost::shared_ptr<apache::thrift::concurrency::ThreadFactory>& threadFactory
= boost::shared_ptr<apache::thrift::concurrency::ThreadFactory>(
const stdcxx::shared_ptr<apache::thrift::TProcessor>& processor,
const stdcxx::shared_ptr<apache::thrift::transport::TServerTransport>& serverTransport,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& inputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::transport::TTransportFactory>& outputTransportFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory,
const stdcxx::shared_ptr<apache::thrift::concurrency::ThreadFactory>& threadFactory
= stdcxx::shared_ptr<apache::thrift::concurrency::ThreadFactory>(
new apache::thrift::concurrency::PlatformThreadFactory(false)));
virtual ~TThreadedServer();
@@ -95,14 +95,14 @@ protected:
/**
* Implementation of TServerFramework::onClientConnected
*/
virtual void onClientConnected(const boost::shared_ptr<TConnectedClient>& pClient) /* override */;
virtual void onClientConnected(const stdcxx::shared_ptr<TConnectedClient>& pClient) /* override */;
/**
* Implementation of TServerFramework::onClientDisconnected
*/
virtual void onClientDisconnected(TConnectedClient *pClient) /* override */;
boost::shared_ptr<apache::thrift::concurrency::ThreadFactory> threadFactory_;
stdcxx::shared_ptr<apache::thrift::concurrency::ThreadFactory> threadFactory_;
/**
* A helper wrapper used to wrap the client in something we can use to maintain
@@ -114,16 +114,16 @@ protected:
class TConnectedClientRunner : public apache::thrift::concurrency::Runnable
{
public:
TConnectedClientRunner(const boost::shared_ptr<TConnectedClient>& pClient);
TConnectedClientRunner(const stdcxx::shared_ptr<TConnectedClient>& pClient);
virtual ~TConnectedClientRunner();
void run() /* override */;
private:
boost::shared_ptr<TConnectedClient> pClient_;
stdcxx::shared_ptr<TConnectedClient> pClient_;
};
apache::thrift::concurrency::Monitor clientMonitor_;
typedef std::map<TConnectedClient *, boost::shared_ptr<apache::thrift::concurrency::Thread> > ClientMap;
typedef std::map<TConnectedClient *, stdcxx::shared_ptr<apache::thrift::concurrency::Thread> > ClientMap;
/**
* A map of active clients

View File

@@ -0,0 +1,124 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef _THRIFT_STDCXX_H_
#define _THRIFT_STDCXX_H_ 1
#include <boost/config.hpp>
///////////////////////////////////////////////////////////////////
//
// functional (function, bind)
//
///////////////////////////////////////////////////////////////////
#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) || (defined(_MSC_VER) && _MSC_VER < 1800) || defined(FORCE_BOOST_FUNCTIONAL)
#include <boost/tr1/functional.hpp>
#define _THRIFT_FUNCTIONAL_TR1_ 1
#endif
#if _THRIFT_FUNCTIONAL_TR1_
namespace apache { namespace thrift { namespace stdcxx {
using ::std::tr1::bind;
using ::std::tr1::function;
namespace placeholders {
using ::std::tr1::placeholders::_1;
using ::std::tr1::placeholders::_2;
using ::std::tr1::placeholders::_3;
using ::std::tr1::placeholders::_4;
using ::std::tr1::placeholders::_5;
using ::std::tr1::placeholders::_6;
using ::std::tr1::placeholders::_7;
using ::std::tr1::placeholders::_8;
using ::std::tr1::placeholders::_9;
} // apache::thrift::stdcxx::placeholders
}}} // apache::thrift::stdcxx
#else
#include <functional>
namespace apache { namespace thrift { namespace stdcxx {
using ::std::bind;
using ::std::function;
namespace placeholders {
using ::std::placeholders::_1;
using ::std::placeholders::_2;
using ::std::placeholders::_3;
using ::std::placeholders::_4;
using ::std::placeholders::_5;
using ::std::placeholders::_6;
using ::std::placeholders::_7;
using ::std::placeholders::_8;
using ::std::placeholders::_9;
} // apache::thrift::stdcxx::placeholders
}}} // apache::thrift::stdcxx
#endif
///////////////////////////////////////////////////////////////////
//
// Smart Pointers
//
///////////////////////////////////////////////////////////////////
// We can use std for memory functions only if the compiler supports template aliasing
// The macro BOOST_NO_CXX11_SMART_PTR is defined as 1 under Visual Studio 2010 and 2012
// which do not support the feature, so we must continue to use C++98 and boost on them.
// We cannot use __cplusplus to detect this either, since Microsoft advertises an older one.
#if defined(BOOST_NO_CXX11_SMART_PTR) || (defined(_MSC_VER) && _MSC_VER < 1800) || defined(FORCE_BOOST_SMART_PTR)
#include <boost/smart_ptr.hpp>
#else
#include <memory>
#endif
namespace apache { namespace thrift { namespace stdcxx {
#if defined(BOOST_NO_CXX11_SMART_PTR) || (defined(_MSC_VER) && _MSC_VER < 1800) || defined(FORCE_BOOST_SMART_PTR)
using ::boost::const_pointer_cast;
using ::boost::dynamic_pointer_cast;
using ::boost::enable_shared_from_this;
using ::boost::make_shared;
using ::boost::scoped_ptr;
using ::boost::shared_ptr;
using ::boost::static_pointer_cast;
using ::boost::weak_ptr;
#else
using ::std::const_pointer_cast;
using ::std::dynamic_pointer_cast;
using ::std::enable_shared_from_this;
using ::std::make_shared;
template <typename T> using scoped_ptr = std::unique_ptr<T>; // compiler must support template aliasing
using ::std::shared_ptr;
using ::std::static_pointer_cast;
using ::std::weak_ptr;
#endif
}}} // apache::thrift::stdcxx
#endif // #ifndef _THRIFT_STDCXX_H_

View File

@@ -361,9 +361,13 @@ void TMemoryBuffer::ensureCanWrite(uint32_t len) {
}
// Grow the buffer as necessary.
uint32_t new_size = bufferSize_;
uint64_t new_size = bufferSize_;
while (len > avail) {
new_size = new_size > 0 ? new_size * 2 : 1;
if (new_size > std::numeric_limits<uint32_t>::max()) {
throw TTransportException(TTransportException::BAD_ARGS,
"Internal buffer size exceeded 2GB");
}
avail = available_write() + (new_size - bufferSize_);
}

View File

@@ -186,7 +186,7 @@ public:
static const int DEFAULT_BUFFER_SIZE = 512;
/// Use default buffer sizes.
TBufferedTransport(boost::shared_ptr<TTransport> transport)
TBufferedTransport(stdcxx::shared_ptr<TTransport> transport)
: transport_(transport),
rBufSize_(DEFAULT_BUFFER_SIZE),
wBufSize_(DEFAULT_BUFFER_SIZE),
@@ -196,7 +196,7 @@ public:
}
/// Use specified buffer sizes.
TBufferedTransport(boost::shared_ptr<TTransport> transport, uint32_t sz)
TBufferedTransport(stdcxx::shared_ptr<TTransport> transport, uint32_t sz)
: transport_(transport),
rBufSize_(sz),
wBufSize_(sz),
@@ -206,7 +206,7 @@ public:
}
/// Use specified read and write buffer sizes.
TBufferedTransport(boost::shared_ptr<TTransport> transport, uint32_t rsz, uint32_t wsz)
TBufferedTransport(stdcxx::shared_ptr<TTransport> transport, uint32_t rsz, uint32_t wsz)
: transport_(transport),
rBufSize_(rsz),
wBufSize_(wsz),
@@ -255,7 +255,7 @@ public:
*/
virtual const uint8_t* borrowSlow(uint8_t* buf, uint32_t* len);
boost::shared_ptr<TTransport> getUnderlyingTransport() { return transport_; }
stdcxx::shared_ptr<TTransport> getUnderlyingTransport() { return transport_; }
/*
* TVirtualTransport provides a default implementation of readAll().
@@ -270,7 +270,7 @@ protected:
// Write size never changes.
}
boost::shared_ptr<TTransport> transport_;
stdcxx::shared_ptr<TTransport> transport_;
uint32_t rBufSize_;
uint32_t wBufSize_;
@@ -291,8 +291,8 @@ public:
/**
* Wraps the transport into a buffered one.
*/
virtual boost::shared_ptr<TTransport> getTransport(boost::shared_ptr<TTransport> trans) {
return boost::shared_ptr<TTransport>(new TBufferedTransport(trans));
virtual stdcxx::shared_ptr<TTransport> getTransport(stdcxx::shared_ptr<TTransport> trans) {
return stdcxx::shared_ptr<TTransport>(new TBufferedTransport(trans));
}
};
@@ -319,7 +319,7 @@ public:
initPointers();
}
TFramedTransport(boost::shared_ptr<TTransport> transport)
TFramedTransport(stdcxx::shared_ptr<TTransport> transport)
: transport_(transport),
rBufSize_(0),
wBufSize_(DEFAULT_BUFFER_SIZE),
@@ -330,7 +330,7 @@ public:
initPointers();
}
TFramedTransport(boost::shared_ptr<TTransport> transport,
TFramedTransport(stdcxx::shared_ptr<TTransport> transport,
uint32_t sz,
uint32_t bufReclaimThresh = (std::numeric_limits<uint32_t>::max)())
: transport_(transport),
@@ -366,7 +366,7 @@ public:
const uint8_t* borrowSlow(uint8_t* buf, uint32_t* len);
boost::shared_ptr<TTransport> getUnderlyingTransport() { return transport_; }
stdcxx::shared_ptr<TTransport> getUnderlyingTransport() { return transport_; }
/*
* TVirtualTransport provides a default implementation of readAll().
@@ -407,7 +407,7 @@ protected:
this->write((uint8_t*)&pad, sizeof(pad));
}
boost::shared_ptr<TTransport> transport_;
stdcxx::shared_ptr<TTransport> transport_;
uint32_t rBufSize_;
uint32_t wBufSize_;
@@ -430,8 +430,8 @@ public:
/**
* Wraps the transport into a framed one.
*/
virtual boost::shared_ptr<TTransport> getTransport(boost::shared_ptr<TTransport> trans) {
return boost::shared_ptr<TTransport>(new TFramedTransport(trans));
virtual stdcxx::shared_ptr<TTransport> getTransport(stdcxx::shared_ptr<TTransport> trans) {
return stdcxx::shared_ptr<TTransport>(new TFramedTransport(trans));
}
};

View File

@@ -31,7 +31,7 @@
#include <io.h>
#endif
using namespace std;
using std::string;
namespace apache {
namespace thrift {

View File

@@ -24,7 +24,6 @@
#include <thrift/transport/PlatformSocket.h>
#include <thrift/concurrency/FunctionRunner.h>
#include <boost/scoped_ptr.hpp>
#include <boost/version.hpp>
#if (BOOST_VERSION >= 105700)
#include <boost/move/unique_ptr.hpp>
@@ -62,7 +61,7 @@ namespace apache {
namespace thrift {
namespace transport {
using boost::shared_ptr;
using stdcxx::shared_ptr;
using std::cerr;
using std::cout;
using std::endl;
@@ -853,7 +852,7 @@ void TFileTransport::seekToChunk(int32_t chunk) {
uint32_t oldReadTimeout = getReadTimeout();
setReadTimeout(NO_TAIL_READ_TIMEOUT);
// keep on reading unti the last event at point of seekChunk call
boost::scoped_ptr<eventInfo> event;
shared_ptr<eventInfo> event;
while ((offset_ + readState_.bufferPtr_) < minEndOffset) {
event.reset(readEvent());
if (event.get() == NULL) {

View File

@@ -28,8 +28,7 @@
#include <stdio.h>
#include <boost/atomic.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <thrift/concurrency/Mutex.h>
#include <thrift/concurrency/Monitor.h>
@@ -340,7 +339,7 @@ private:
// writer thread
apache::thrift::concurrency::PlatformThreadFactory threadFactory_;
boost::shared_ptr<apache::thrift::concurrency::Thread> writerThread_;
stdcxx::shared_ptr<apache::thrift::concurrency::Thread> writerThread_;
// buffers to hold data before it is flushed. Each element of the buffer stores a msg that
// needs to be written to the file. The buffers are swapped by the writer thread.
@@ -349,7 +348,7 @@ private:
// conditions used to block when the buffer is full or empty
Monitor notFull_, notEmpty_;
bool closing_;
boost::atomic<bool> closing_;
// To keep track of whether the buffer has been flushed
Monitor flushed_;
@@ -391,14 +390,14 @@ public:
* @param protocolFactory protocol factory
* @param inputTransport file transport
*/
TFileProcessor(boost::shared_ptr<TProcessor> processor,
boost::shared_ptr<TProtocolFactory> protocolFactory,
boost::shared_ptr<TFileReaderTransport> inputTransport);
TFileProcessor(stdcxx::shared_ptr<TProcessor> processor,
stdcxx::shared_ptr<TProtocolFactory> protocolFactory,
stdcxx::shared_ptr<TFileReaderTransport> inputTransport);
TFileProcessor(boost::shared_ptr<TProcessor> processor,
boost::shared_ptr<TProtocolFactory> inputProtocolFactory,
boost::shared_ptr<TProtocolFactory> outputProtocolFactory,
boost::shared_ptr<TFileReaderTransport> inputTransport);
TFileProcessor(stdcxx::shared_ptr<TProcessor> processor,
stdcxx::shared_ptr<TProtocolFactory> inputProtocolFactory,
stdcxx::shared_ptr<TProtocolFactory> outputProtocolFactory,
stdcxx::shared_ptr<TFileReaderTransport> inputTransport);
/**
* Constructor
@@ -408,10 +407,10 @@ public:
* @param inputTransport input file transport
* @param output output transport
*/
TFileProcessor(boost::shared_ptr<TProcessor> processor,
boost::shared_ptr<TProtocolFactory> protocolFactory,
boost::shared_ptr<TFileReaderTransport> inputTransport,
boost::shared_ptr<TTransport> outputTransport);
TFileProcessor(stdcxx::shared_ptr<TProcessor> processor,
stdcxx::shared_ptr<TProtocolFactory> protocolFactory,
stdcxx::shared_ptr<TFileReaderTransport> inputTransport,
stdcxx::shared_ptr<TTransport> outputTransport);
/**
* processes events from the file
@@ -428,11 +427,11 @@ public:
void processChunk();
private:
boost::shared_ptr<TProcessor> processor_;
boost::shared_ptr<TProtocolFactory> inputProtocolFactory_;
boost::shared_ptr<TProtocolFactory> outputProtocolFactory_;
boost::shared_ptr<TFileReaderTransport> inputTransport_;
boost::shared_ptr<TTransport> outputTransport_;
stdcxx::shared_ptr<TProcessor> processor_;
stdcxx::shared_ptr<TProtocolFactory> inputProtocolFactory_;
stdcxx::shared_ptr<TProtocolFactory> outputProtocolFactory_;
stdcxx::shared_ptr<TFileReaderTransport> inputTransport_;
stdcxx::shared_ptr<TTransport> outputTransport_;
};
}
}

View File

@@ -22,6 +22,7 @@
#include <thrift/protocol/TProtocolTypes.h>
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/protocol/TCompactProtocol.h>
#include <thrift/stdcxx.h>
#include <limits>
#include <utility>
@@ -30,12 +31,14 @@
#include <zlib.h>
using std::map;
using boost::shared_ptr;
using std::string;
using std::vector;
namespace apache {
namespace thrift {
using stdcxx::shared_ptr;
namespace transport {
using namespace apache::thrift::protocol;
@@ -255,7 +258,7 @@ void THeaderTransport::readHeaderFormat(uint16_t headerSize, uint32_t sz) {
}
// Untransform the data section. rBuf will contain result.
untransform(data, safe_numeric_cast<uint32_t>(static_cast<ptrdiff_t>(sz) - (data - rBuf_.get())));
untransform(data, safe_numeric_cast<uint32_t>(static_cast<ptrdiff_t>(sz) - (data - rBuf_.get())));
}
void THeaderTransport::untransform(uint8_t* ptr, uint32_t sz) {

View File

@@ -34,7 +34,7 @@
#endif
#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
#include <thrift/stdcxx.h>
#include <thrift/protocol/TProtocolTypes.h>
#include <thrift/transport/TBufferTransports.h>
@@ -75,7 +75,7 @@ public:
static const int THRIFT_MAX_VARINT32_BYTES = 5;
/// Use default buffer sizes.
explicit THeaderTransport(const boost::shared_ptr<TTransport>& transport)
explicit THeaderTransport(const stdcxx::shared_ptr<TTransport>& transport)
: TVirtualTransport(transport),
outTransport_(transport),
protoId(T_COMPACT_PROTOCOL),
@@ -88,8 +88,8 @@ public:
initBuffers();
}
THeaderTransport(const boost::shared_ptr<TTransport> inTransport,
const boost::shared_ptr<TTransport> outTransport)
THeaderTransport(const stdcxx::shared_ptr<TTransport> inTransport,
const stdcxx::shared_ptr<TTransport> outTransport)
: TVirtualTransport(inTransport),
outTransport_(outTransport),
protoId(T_COMPACT_PROTOCOL),
@@ -186,7 +186,7 @@ protected:
setWriteBuffer(wBuf_.get(), wBufSize_);
}
boost::shared_ptr<TTransport> outTransport_;
stdcxx::shared_ptr<TTransport> outTransport_;
// 0 and 16th bits must be 0 to differentiate from framed & unframed
static const uint32_t HEADER_MAGIC = 0x0FFF0000;
@@ -265,8 +265,8 @@ public:
/**
* Wraps the transport into a header one.
*/
virtual boost::shared_ptr<TTransport> getTransport(boost::shared_ptr<TTransport> trans) {
return boost::shared_ptr<TTransport>(new THeaderTransport(trans));
virtual stdcxx::shared_ptr<TTransport> getTransport(stdcxx::shared_ptr<TTransport> trans) {
return stdcxx::shared_ptr<TTransport>(new THeaderTransport(trans));
}
};
}

View File

@@ -26,20 +26,20 @@
#include <thrift/transport/THttpClient.h>
#include <thrift/transport/TSocket.h>
using std::string;
namespace apache {
namespace thrift {
namespace transport {
using namespace std;
THttpClient::THttpClient(boost::shared_ptr<TTransport> transport,
THttpClient::THttpClient(stdcxx::shared_ptr<TTransport> transport,
std::string host,
std::string path)
: THttpTransport(transport), host_(host), path_(path) {
}
THttpClient::THttpClient(string host, int port, string path)
: THttpTransport(boost::shared_ptr<TTransport>(new TSocket(host, port))),
: THttpTransport(stdcxx::shared_ptr<TTransport>(new TSocket(host, port))),
host_(host),
path_(path) {
}

View File

@@ -28,7 +28,7 @@ namespace transport {
class THttpClient : public THttpTransport {
public:
THttpClient(boost::shared_ptr<TTransport> transport, std::string host, std::string path = "");
THttpClient(stdcxx::shared_ptr<TTransport> transport, std::string host, std::string path = "");
THttpClient(std::string host, int port, std::string path = "");

View File

@@ -28,13 +28,13 @@
#include <Shlwapi.h>
#endif
using std::string;
namespace apache {
namespace thrift {
namespace transport {
using namespace std;
THttpServer::THttpServer(boost::shared_ptr<TTransport> transport) : THttpTransport(transport) {
THttpServer::THttpServer(stdcxx::shared_ptr<TTransport> transport) : THttpTransport(transport) {
}
THttpServer::~THttpServer() {

View File

@@ -28,7 +28,7 @@ namespace transport {
class THttpServer : public THttpTransport {
public:
THttpServer(boost::shared_ptr<TTransport> transport);
THttpServer(stdcxx::shared_ptr<TTransport> transport);
virtual ~THttpServer();
@@ -53,8 +53,8 @@ public:
/**
* Wraps the transport into a buffered one.
*/
virtual boost::shared_ptr<TTransport> getTransport(boost::shared_ptr<TTransport> trans) {
return boost::shared_ptr<TTransport>(new THttpServer(trans));
virtual stdcxx::shared_ptr<TTransport> getTransport(stdcxx::shared_ptr<TTransport> trans) {
return stdcxx::shared_ptr<TTransport>(new THttpServer(trans));
}
};
}

Some files were not shown because too many files have changed in this diff Show More