• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Max time of a thread in service method

 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do anyone knows how long a thread can stay in service method? is there a max time in tomcat?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the problem is more frequently related to how long the browser will try to keep the connection open, not the limit in Tomcat.
However you might check the connectionTimeout in the server.xml Connector element.
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
[ March 13, 2004: Message edited by: William Brogden ]
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm facing a really bad problem! some times a thread spends too much time in a servie method (some times in a synchronized block) this blocks other threads and the hole thing goes down! any advise? The cause of threads spending lots of time in the service method is because they try to use a data base resource allready blocked by some user (outside the aplication), that forgets to release this resource!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There have been a number of related discussions in the servlet forum about requests that take a long time. You could probably find them by searching.
Generally, the conclusion is that you should start a separate Thread in a Runnable object that tries to perform the time-consuming operation, while the request/response Thread writes something reasonable back to the client.
Naturally you keep a reference to the worker class in the session so that subsequent requests can look to see how well it is doing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic