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

Ben Craig commented on THRIFT-2441:
-----------------------------------

I guess I skipped a few items in my approach.  Here they come now...
4. Add a 'death_listener' constructor to TSocket.  This is in addition to the 
current THRIFT_SOCKET TSocket constructor.
a. If the death_listener constructor is used, read will have an extra select 
call.  If the single argument THRIFT_SOCKET constructor is used, read will not 
have the extra select call.
5. Add a 'enableChildInterruption(bool)' function on TServerSocket.  This is 
pretty much the 'setter' from my first proposal.
a. If child interruption is enabled, the death_listener TSocket constructor 
will be used during accept.  If child interruption is disabled, the single 
argument THRIFT_SOCKET constructor is used.
b. Regardless of the 'enableChildInterruption' state, 
interruptServerAndChildren() would write to the death_writer end of the 
socket_pair.  There may not be anyone listening though.

I think I prefer the name 'interruptServerAndChildren()' to 'stop()'.  
TServerTransport already has an interrupt() and a close() method, and it would 
be really confusing to have a method named stop().  It isn't clear in that case 
how stop() relates to close() and interrupt().  I think the longer name better 
conveys the relation between the methods.  I do think that both of us are 
talking about the same method though, we are just calling it different things.

> Cannot shutdown TThreadedServer when clients are still connected
> ----------------------------------------------------------------
>
>                 Key: THRIFT-2441
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2441
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9.1
>            Reporter: Chris Stylianou
>            Assignee: Ben Craig
>
> When calling stop() on the TThreadedServer no interrupts are sent to the 
> client threads. This means the stop() call blocks on tasksMonitor.wait() 
> until all client naturally disconnect.
> How can we tell the client thread connections to close/exit during the 
> TThreadedServer::stop() call?



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

Reply via email to