Reputation: 3011
I am trying to port an application that uses TThreadedServer
to use TThreadPoolServer
. I am currently using the class this way:
TThreadPoolServer server(
processor),
server_transport,
transport_factory,
protocol_factory);
server.serve()
I get the following exception when the client tries to connect:
terminate called after throwing an instance of 'apache::thrift::concurrency::IllegalStateException' what(): ThreadManager::Impl::add ThreadManager not started
I see that a ThreadManager
instance is being created in the constructor of TThreadPoolServer
here. If a ThreadManager object has to be passed to the constructor of TThreadPoolServer
, I am not sure why the constructor creates a ThreadManager
object. I tried to create a ThreadManger
object and call the start()
method as given here but the PosixThreadFactory
is not part of the Thrift framework anymore. Do I have to implement the ThreadFactory
abstract class? Can you please help me figure out this by providing a sample usage?
Upvotes: 1
Views: 768
Reputation: 1039
I personally find the Thrift TestServer and TestClient very good resources for getting started. They outline a broad range of possible options, including different server types. If you build from source, you can run the server and client from the command line. This makes it fairly easy to test a specific scenario before implementing it yourself.
For the TThreadPoolServer
you can find the relevant section in the lines following the TThreadPoolServer creation. That should show all required steps to set up a TThreadPoolServer
with basic parameters.
Does that help?
Upvotes: 2