Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class thrift_server_thread
- {
- public:
- server_thread(shared_state & shared_state);
- //Entry point for thread wherein Thrift server is started.
- //The TSimpleServer instance(on which I was previously
- //invoking stop from the main thread) is owned(?) by this thread/class.
- void operator()();
- //I modified the design for it to be invoked in the same thread/object
- //which seems to have resolved the issue
- void stop()
- {
- _server->stop();
- }
- private:
- boost::shared_ptr<apache::thrift::server::TSimpleServer> _server;
- //Design note: the thrift server needs a handler class for the various
- //endpoints exposed. This handler is typically implemented as a separate
- //class from 'the context' in which the server is started.
- //However when 'stop server' becomes an endpoint, the handler needs a
- //a way to invoke stop on the server - which leads to a circular
- //dependency for which I have a rather hacky solution. Any suggestions
- //in this regard would be appreciated.
- };
Advertisement
Add Comment
Please, Sign In to add comment