tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier (tomcat)>
Subject Re: Stopping any Tomcat thread running more than an amount of time
Date Mon, 30 Jan 2017 14:05:28 GMT
On 30.01.2017 00:43, Konstantin Kolinko wrote:
> 2017-01-23 16:06 GMT+03:00 André Warnier (tomcat) <>:
>> On 23.01.2017 13:41, Abdessamed Mansouri wrote:
>>> Hello, Thank you for your answers, we are integratting JSF (Mojarra) and
>>> using it, so in many cases, in the same page there's some functionnalities
>>> which work and other not, there's also some functionnalities which work
>>> with a little data (reasonable time) but with a little larger data take
>>> too
>>> much time because of bad implementation and i have fear to say that we
>>> really don't know all,the functionnalities which dont work (takes too much
>>> time).
>>> We think this is the only (not necessary) temporary solution.
>>> Thank you all.
>> Hi. Apart from the suggestions below, I don't think that there is anything
>> "out of the box" which does the kind of thing you want.
>> So you might have to write this yourself.
>> I am not really an expert, but in terms of architecture this might be a job
>> for a "servlet filter", which starts a timer before forwarding the call to
>> the real application.
>> How the filter would have to react, when it is called by the timer after 5
>> minutes, in order to "kill" the running servlet and return an informative
>> response to the caller, is beyond me though, specially without modifying the
>> servlet itself.
>> Generating an exception and catching it in the response part of the filter ?
> FYI:
> org.apache.catalina.valves.StuckThreadDetectionValve

Thanks, Konstantin.
That seems like it could be at least part of the answer.
What is not clear (to me) is : what happens exactly in the thread that is "interrupted" in

this way ? Some kind of exception that could be caught at some level, to return some 
informative message to the waiting client ?

Or is this a good enough explanation : ?
(The "Quote from Thread.interrupt() API:" part)

An auxiliary question may be : a Valve is tomcat-specific, and also applies to all 
applications indifferently.  Could this code easily be modified into a servlet filter 
(which can be mapped more specifically to application parts) ? Or is there something 
inherently and fundamentally "Valve-like" in that code, which would make it better to 
start from scratch to write a filter ?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message