THRIFT-3397 Implement TProcessorFactory in C# to enable per-client processors
Client: C#
Patch: Jonathan Heard

This closes #663
diff --git a/lib/csharp/src/Server/TServer.cs b/lib/csharp/src/Server/TServer.cs
index a2631a9..cee2ae3 100644
--- a/lib/csharp/src/Server/TServer.cs
+++ b/lib/csharp/src/Server/TServer.cs
@@ -31,7 +31,7 @@
   public abstract class TServer
   {
     //Attributes
-    protected TProcessor processor;
+    protected TProcessorFactory processorFactory;
     protected TServerTransport serverTransport;
     protected TTransportFactory inputTransportFactory;
     protected TTransportFactory outputTransportFactory;
@@ -65,14 +65,25 @@
     //Construction
     public TServer(TProcessor processor,
               TServerTransport serverTransport)
-      : this(processor, serverTransport, new TTransportFactory(), new TTransportFactory(), new TBinaryProtocol.Factory(), new TBinaryProtocol.Factory(), DefaultLogDelegate)
+      : this(processor, serverTransport, 
+         new TTransportFactory(), 
+         new TTransportFactory(), 
+         new TBinaryProtocol.Factory(), 
+         new TBinaryProtocol.Factory(), 
+         DefaultLogDelegate)
     {
     }
 
     public TServer(TProcessor processor,
             TServerTransport serverTransport,
             LogDelegate logDelegate)
-      : this(processor, serverTransport, new TTransportFactory(), new TTransportFactory(), new TBinaryProtocol.Factory(), new TBinaryProtocol.Factory(), DefaultLogDelegate)
+      : this(processor, 
+         serverTransport, 
+         new TTransportFactory(), 
+         new TTransportFactory(), 
+         new TBinaryProtocol.Factory(), 
+         new TBinaryProtocol.Factory(), 
+         logDelegate)
     {
     }
 
@@ -104,6 +115,23 @@
     }
 
     public TServer(TProcessor processor,
+        TServerTransport serverTransport,
+        TTransportFactory inputTransportFactory,
+        TTransportFactory outputTransportFactory,
+        TProtocolFactory inputProtocolFactory,
+        TProtocolFactory outputProtocolFactory,
+        LogDelegate logDelegate)
+    {
+        this.processorFactory = new TSingletonProcessorFactory(processor);
+        this.serverTransport = serverTransport;
+        this.inputTransportFactory = inputTransportFactory;
+        this.outputTransportFactory = outputTransportFactory;
+        this.inputProtocolFactory = inputProtocolFactory;
+        this.outputProtocolFactory = outputProtocolFactory;
+        this.logDelegate = (logDelegate != null) ? logDelegate : DefaultLogDelegate;
+    }
+
+    public TServer(TProcessorFactory processorFactory,
               TServerTransport serverTransport,
               TTransportFactory inputTransportFactory,
               TTransportFactory outputTransportFactory,
@@ -111,13 +139,13 @@
               TProtocolFactory outputProtocolFactory,
               LogDelegate logDelegate)
     {
-      this.processor = processor;
-      this.serverTransport = serverTransport;
-      this.inputTransportFactory = inputTransportFactory;
-      this.outputTransportFactory = outputTransportFactory;
-      this.inputProtocolFactory = inputProtocolFactory;
-      this.outputProtocolFactory = outputProtocolFactory;
-      this.logDelegate = (logDelegate != null) ? logDelegate : DefaultLogDelegate;
+        this.processorFactory = processorFactory;
+        this.serverTransport = serverTransport;
+        this.inputTransportFactory = inputTransportFactory;
+        this.outputTransportFactory = outputTransportFactory;
+        this.inputProtocolFactory = inputProtocolFactory;
+        this.outputProtocolFactory = outputProtocolFactory;
+        this.logDelegate = (logDelegate != null) ? logDelegate : DefaultLogDelegate;
     }
 
     //Abstract Interface