thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Slifka <rsli...@sfu.ca>
Subject C++ Server Error-handling Question
Date Mon, 21 Sep 2009 21:08:31 GMT
Hi everyone, 

We're using the C++ Thrift server now and I had a question. 

In the implementation of listen() for TSimpleServer and TThreaderServer: 

try { 
// Start the server listening 
serverTransport_->listen(); 
} catch (TTransportException& ttx) { 
string errStr = string("TThreadedServer::run() listen(): ") +ttx.what(); 
GlobalOutput(errStr.c_str()); 
return; 
} 

This sort of limits our error handling ability :) If for example the port is in use in our
development environment we'd like to automatically pick a different port. 

I see that I might be able to specify a function pointer to GlobalOutput although I haven't
looked in detail. That just takes a string though. 

Was the intent that packaged server classes be subclassed for error handling? The trouble
is that for TSimpleServer and TThreadedServer, everything (including the call to listen())
is inside of serve(). 

Is there another way to do this? 

Thanks, 

Rob 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message