thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Emmenlauer <ma...@emmenlauer.de>
Subject Re: TSimpleServer.java does not stop when asked to...
Date Thu, 13 Jul 2017 18:10:48 GMT

Ok, I found a bit more info myself, but still would need some help.
Below more:

On 13.07.2017 15:04, Mario Emmenlauer wrote:
> I have a Java TSimpleServer runnable in a thread running. The
> main thread eventually asks the server to stop(). But they seem
> to ignore the request. I checked the code of TSimpleServer.java
> and I'm under the impression that the innermost loop the server
> does not poll the variable stopped_ or does it?
> 
> https://github.com/apache/thrift/blob/master/lib/java/src/org/apache/thrift/server/TSimpleServer.java
> [...] from line 76:
> 
>           while (true) {
>             if (eventHandler_ != null) {
>               eventHandler_.processContext(connectionContext, inputTransport, outputTransport);
>             }
>             if(!processor.process(inputProtocol, outputProtocol)) {
>               break;
>             }
>           }

I found that this loop is only interrupted if the client disconnects.
I tried changing 'while(true)' for 'while(!stopped_)' but that did
not help. I guess that one of the methods in the loop must be blocking.

Furthermore I found https://issues.apache.org/jira/browse/THRIFT-2441
'Cannot shutdown TThreadedServer when clients are still connected'
that seems to address exactly my issue! But it addresses only C++
code, not the Java servers, is that correct?

Should I open a new issue for this problem? Or am I on the wrong
track here?

> Do I understand correctly that the TSimpleServer will only check
> stopped_ when there is no client connected? Personally I would
> prefer if the client can not "force" my server to continue running.
> If required, clients should be forcibly disconnected on stop().
> 
> Is there a way to achieve that? I found no methods "forceStop()" or
> "disconnectClients()" or something like it. Am I even on the right
> track?


All the best,

    Mario Emmenlauer

Mime
View raw message