You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/04/27 00:34:38 UTC

[jira] [Commented] (THRIFT-3083) C++ Consolidate server processing loops in TSimpleServer, TThreadedServer, TThreadPoolServer

    [ https://issues.apache.org/jira/browse/THRIFT-3083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14513310#comment-14513310 ] 

ASF GitHub Bot commented on THRIFT-3083:
----------------------------------------

GitHub user jeking3 opened a pull request:

    https://github.com/apache/thrift/pull/466

    THRIFT-3083 consolidate simple and threaded server run loops

    Currently the simple and threaded servers all share a very similar serve() workflow.  This improvement story is to consolidate them and extract out the specific differences to limit code duplication.
    
    The server processing loop which is common to TSimpleServer, TThreadedServer, TThreadPoolServer is now in one place.  This improves the predictability of thrift and helps improve maintainability.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jeking3/thrift bugfix/THRIFT-3083-following-THRIFT-3081-merge-to-master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/466.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #466
    
----
commit 0446bc77d855afa13cb9791011f01f37c91db386
Author: Jim King <ji...@simplivity.com>
Date:   2015-04-26T22:30:26Z

    THRIFT-3083 consolidate simple and threaded server run loops

----


> C++ Consolidate server processing loops in TSimpleServer, TThreadedServer, TThreadPoolServer
> --------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-3083
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3083
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C++ - Library
>    Affects Versions: 0.8, 0.9, 0.9.1, 0.9.2
>            Reporter: James E. King, III
>         Attachments: THRIFT-3083-server-files.tar, THRIFT-3083.patch
>
>
> Currently the simple and threaded servers all share a very similar serve() workflow.  This improvement story is to consolidate them and extract out the specific differences to limit code duplication.
> 1. Add TServerFramework that implements serve() and stop() for TServer, but is abstract.
> 2. Add virtual methods onClientConnected, onClientDisconnected to TServerFramework and require subclasses to implement them.
> 3. TSimpleServer onClientConnected calls TConnectedClient().run() in the serve() thread, thus blocking the server thread until the client disconnects.
> 4. TThreadedServer::serve() calls TServerFramework::serve() and then waits for the notification that all clients are gone.  ::onClientConnected adds a TConnectedClient to the task set and starts a thread for it.  ::onClientDisconnected removes the client from the task set.
> 5. TThreadPoolServer would have similar changes.
> The resulting classes will be much smaller, and the specific differences between the servers will be more obvious.  Further, the server processing loop which is common to all three will be in one place.  This improves the predictability of thrift and helps improve maintainability.



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