I have a bit of a problem where deep in a servlet there is some
synchronized code that is synchronized on an object in session. On a
rare occasion, that code runs very slowly when a long report is running
or a database slows. This causes the users of the application to keep
clicking stop and refresh- thinking their request is going to run.
Recently when the server stopped responding, I did a kill -3 and found
almost all of the threads waiting for that synchronzied session object-
meaning 1 user had managed to consume a large number of threads be click
refresh.
I realize that I could modify the code to fail out if it couldn't grab
the monitor in a set period of time, but I'd prefer to cancel the thread
that has no web browser endpoint associated with it- the one that holds
the monitor and won't release it until its done with its query.
Basically, if someone refreshes, I'd like to abort any threads they
already have running- or simply allow tomcat to abort the processing
when the threads endpoint goes away.
Is there any way I can accomplish this?
I'm using Tomcat 4.1.31 and Mod_jk2 on apache 2.0.52
Thanks,
Byron
==============================
Byron Guernsey
Senior Software Architect
GE Consumer & Industrial Systems
(502) 452 - 5101