Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3397

Implement TProcessorFactory in C# to enable per-client processors

    XMLWordPrintableJSON

Details

    Description

      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.

      Attachments

        Activity

          People

            JonathanH Jonathan Heard
            JonathanH Jonathan Heard
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 168h
                168h
                Remaining:
                Remaining Estimate - 168h
                168h
                Logged:
                Time Spent - Not Specified
                Not Specified