You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King, III (JIRA)" <ji...@apache.org> on 2015/04/10 20:23:12 UTC

[jira] [Updated] (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:all-tabpanel ]

James E. King, III updated THRIFT-3083:
---------------------------------------
    Attachment: THRIFT-3083.patch

I attached a patch as a preview of the changes - requires THRIFT-2441 and THRIFT-3081 to be applied in that order before THRIFT-3083 can be patched on top of it, but this might give folks an idea of the changes while we wait for the other two to be incorporated.

> 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.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.
> 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.
> Also add TServerEventHandler::postServe to balance out the fact there is a preServe, and document the post-conditions of preServe (TServerTransport is being listened to).



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