tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: Terminating long running request threads
Date Sat, 11 Jun 2011 15:11:20 GMT
On 11.06.2011 09:30, Afkham Azeez wrote:
> Folks,
> Is there any API to get hold of Tomcat's Connector thread pools?

Each request is registered with an MBean in the MBeanServer.
As long as the request is running, the MBean contains additional info,
like the URI, when the request started, the thread name etc.

This gives you enough info to find long running requests and to find the
thread. But there's no non-deprecated Java API known to have no side
effects to terminate a thread. If it were (or you find one), we had to
check how the thread pool behaves w.r.t. "vanishing" threads.

Regards,

Rainer

> On Thu, Jun 9, 2011 at 10:58 PM, Afkham Azeez <afkham@gmail.com> wrote:
> 
>>
>>
>> On Thu, Jun 9, 2011 at 10:51 PM, Caldarale, Charles R <
>> Chuck.Caldarale@unisys.com> wrote:
>>
>>>> From: Afkham Azeez [mailto:afkham@gmail.com]
>>>> Subject: Terminating long running request threads
>>>
>>>> is there a way to get hold of these long running threads
>>>> & terminate them?
>>>
>>> This is not an issue specific to Tomcat; there is no way to safely
>>> terminate a Java thread without the cooperation of that thread.  Best if you
>>> can code your webapp so that your request processors periodically check if
>>> they've been running too long and give up if so.
>>>
>>
>> Yes, it is not a Tomcat specific issue. The thing is, we don't have total
>> control over what type of webapps will be deployed. We do restrict certain
>> operations using a Java Security Manager, but I do not think we can restrict
>> the running time of a Thread using a security manager. Using
>> the ThreadMXBean we can monitor the time each thread takes, and get the
>> thread IDs of long running threads. It may be possible to get that thread to
>> terminate if we have some support for that from the Tomcat threadpool. Just
>> thinking out loud.
>>
>> Thanks
>> Azeez


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message