decimusphostle

Thrift Server Issue - Server Thread

Nov 21st, 2011
762
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. class thrift_server_thread
  2. {
  3. public:
  4. server_thread(shared_state & shared_state);
  5.  
  6. //Entry point for thread wherein Thrift server is started.
  7. //The TSimpleServer instance(on which I was previously
  8. //invoking stop from the main thread) is owned(?) by this thread/class.
  9. void operator()();
  10.  
  11. //I modified the design for it to be invoked in the same thread/object
  12. //which seems to have resolved the issue
  13. void stop()
  14. {
  15. _server->stop();
  16. }
  17.  
  18. private:
  19. boost::shared_ptr<apache::thrift::server::TSimpleServer> _server;
  20.  
  21. //Design note: the thrift server needs a handler class for the various
  22. //endpoints exposed. This handler is typically implemented as a separate
  23. //class from 'the context' in which the server is started.
  24. //However when 'stop server' becomes an endpoint, the handler needs a
  25. //a way to invoke stop on the server - which leads to a circular
  26. //dependency for which I have a rather hacky solution. Any suggestions
  27. //in this regard would be appreciated.
  28. };
Advertisement
Add Comment
Please, Sign In to add comment