Jonathan Heard created THRIFT-3397:
--------------------------------------

             Summary: Implement TProcessorFactory in C# to enable per-client 
processors
                 Key: THRIFT-3397
                 URL: https://issues.apache.org/jira/browse/THRIFT-3397
             Project: Thrift
          Issue Type: New Feature
          Components: C# - Library
    Affects Versions: 0.9.3
            Reporter: Jonathan Heard
            Priority: Minor


The current TServer implementations in C# take a single instance of a 
TProcessor to be used for all client connections. This is not guaranteed to be 
thread-safe and can become a significant bottleneck.

I am implementing a TProcessorFactory interface for C# which is similar to the 
ones already implemented in Java and C++. I'll generate a pull request for 
review soon.

The existing solutions implement TProcessorFactory as a class which takes a 
TProcessor and just returns that instance to all clients. I'm aiming to improve 
on that by creating a TProcessorFactory interface and then implementing it in 
two core classes:
1) TSingletonProcessorFactory - this behaves the same as the Java 
'TProcessorFactory' class.
2) TPrototypeProcessorFactory<Processor,Handler> - this effectively returns a 
'new Processor(Handler)' giving every new client its own processor.

In order to avoid breaking the existing API (and in-keeping with the Java 
implementation),  I have changed TServer so that it uses a TProcessorFactory 
instead of TProcessor and updated all relevant constructors so they call the 
TSingletonProcessorFactory for constructors using TProcessor. New constructors 
have been added to enable calling with TProcessorFactory. This approach should 
avoid breaking the established API and not break any existing code.

I've also updated the TestServer.cs to support these changes.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to