THRIFT-2624: Add TServerEventHandler support to C#
Client: C#
Patch: ra
Adds the TServerEventHandler interface to the C# lib and adds
support in all C# servers.
diff --git a/lib/csharp/test/ThriftTest/TestServer.cs b/lib/csharp/test/ThriftTest/TestServer.cs
index f0f539f..92ef374 100644
--- a/lib/csharp/test/ThriftTest/TestServer.cs
+++ b/lib/csharp/test/ThriftTest/TestServer.cs
@@ -34,6 +34,28 @@
{
public class TestServer
{
+ public class TradeServerEventHandler : TServerEventHandler
+ {
+ public int callCount = 0;
+ public void preServe()
+ {
+ callCount++;
+ }
+ public Object createContext(Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
+ {
+ callCount++;
+ return null;
+ }
+ public void deleteContext(Object serverContext, Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
+ {
+ callCount++;
+ }
+ public void processContext(Object serverContext, Thrift.Transport.TTransport transport)
+ {
+ callCount++;
+ }
+ };
+
public class TestHandler : ThriftTest.Iface
{
public TServer server;
@@ -400,6 +422,10 @@
// Threaded Server
// serverEngine = new TThreadedServer(testProcessor, tServerSocket);
+ //Server event handler
+ TradeServerEventHandler serverEvents = new TradeServerEventHandler();
+ serverEngine.setEventHandler(serverEvents);
+
testHandler.server = serverEngine;
// Run it