Create a TServerEventHandler interface in TServer

Summary: Such that users can supply an event handler to a server that will be used to signal various events that take place inside the server core.

Reviewed By: dreiss

Test Plan: Rebuilt all servers, work by default

Other Notes: Partially submitted and also reviewed by Dave Simpson at Powerset


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665371 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TNonblockingServer.h b/lib/cpp/src/server/TNonblockingServer.h
index 2cdd897..8483306 100644
--- a/lib/cpp/src/server/TNonblockingServer.h
+++ b/lib/cpp/src/server/TNonblockingServer.h
@@ -69,11 +69,6 @@
    */
   std::stack<TConnection*> connectionStack_;
 
-  // Pointer to optional function called after opening the listen socket and
-  // before running the event loop, along with its argument data.
-  void (*preServeCallback_)(void*);
-  void* preServeCallbackArg_;
-
   void handleEvent(int fd, short which);
 
  public:
@@ -84,9 +79,7 @@
     port_(port),
     frameResponses_(true),
     threadPoolProcessing_(false),
-    eventBase_(NULL),
-    preServeCallback_(NULL),
-    preServeCallbackArg_(NULL) {}
+    eventBase_(NULL) {}
 
   TNonblockingServer(boost::shared_ptr<TProcessor> processor,
                      boost::shared_ptr<TProtocolFactory> protocolFactory,
@@ -97,9 +90,7 @@
     port_(port),
     frameResponses_(true),
     threadManager_(threadManager),
-    eventBase_(NULL),
-    preServeCallback_(NULL),
-    preServeCallbackArg_(NULL) {
+    eventBase_(NULL) {
     setInputTransportFactory(boost::shared_ptr<TTransportFactory>(new TTransportFactory()));
     setOutputTransportFactory(boost::shared_ptr<TTransportFactory>(new TTransportFactory()));
     setInputProtocolFactory(protocolFactory);
@@ -118,9 +109,7 @@
     serverSocket_(0),
     port_(port),
     frameResponses_(true),
-    threadManager_(threadManager),
-    preServeCallback_(NULL),
-    preServeCallbackArg_(NULL) {
+    threadManager_(threadManager) {
     setInputTransportFactory(inputTransportFactory);
     setOutputTransportFactory(outputTransportFactory);
     setInputProtocolFactory(inputProtocolFactory);
@@ -171,11 +160,6 @@
 
   void serve();
 
-  void setPreServeCallback(void(*fn_ptr)(void*), void* arg = NULL) {
-    preServeCallback_ = fn_ptr;
-    preServeCallbackArg_ = arg;
-  }
-
 };
 
 /**