• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interview question asked to me which I could not answer

 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Can we set request to be timedout? If so, where do we do it? Can we do it in web.xml declaratively or programatically in servelt? Or maybe in JSP? Need some help.

Thanks.
 
arulk pillai
Author
Ranch Hand
Posts: 3388
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your Web container is the one spawning new threads to service the request. So, it should be a configuration in your container to timeout the thread. For example, in Webshere you can configure the thread pool size and the timeouts.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Arulk for the reply. Can you tell me how to configure the thread pool size and the timeouts?
[ October 20, 2008: Message edited by: Arjun Reddy ]
 
Gopikrishna Madishetti
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<session-config>
<session-timeout>120</session-timeout>
</session-config>


Thanks.
 
Sky Loi
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So far I know in Tomcat, there is server.xml config file. You could find the connectors section to config the thread pool and timeout. Hope it will help you.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gopikrishna Madishetti:
<session-config>
<session-timeout>120</session-timeout>
</session-config>
That controls how long a session will be inactive before the container can invalidate it. The original question was "Can we set request to be timedout?" which has nothing to do with sessions.

I'm not sure what it would mean for a request to "time out". I wouldn't be surprised if a client (e.g. a browser) stopped waiting for a response after X seconds or minutes, but naturally that can't be controlled by the server in any way.
 
Sky Loi
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Paul. If the 'timeout' is meant in client side, you could define the timeout in client socket before you send request.
 
Adam Asham
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really, jsp/servlets don't have this? What about the servlet containers?
Asp.Net has this and even PHP offers script execution timeout at the backend. So what this means is that a request could potentially hang continuously until the container is restarted?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic