This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes will refresh create new thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "will refresh create new thread" Watch "will refresh create new thread" New topic
Author

will refresh create new thread

tejo kartheek
Greenhorn

Joined: Feb 04, 2008
Posts: 13
Hi,
I had a doubt that whether pressing Refresh Button will create a new thread or not? i.e suppose if we are trying to access one servlet or jsp page from a server(a thread will be created to look after that) and due to some reason it got delayed.Now if we press Refresh Button what it will do???whether it will recreate the first thread or it kills the first thread and then creates a new thread???
can any one explain clearly what will happen internally???
Jorge Pinho
Greenhorn

Joined: May 16, 2003
Posts: 25

Hi,

For each request there is a new thread, if a user closes the browser, the server isnt aware of that, but, when the serves ends the request, the thread dies.

If you hit refresh, your previous request was canceled, but the first thread will do its job anyway, and will die.
[ February 13, 2008: Message edited by: Jorge Pinho ]

Jorge Pinho / SCJP 5
Live Help via Skype - lets.talk.about.help
Dont wait for forum answers
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12760
    
    5
ecreate the first thread or it kills the first thread and then creates a new thread???


Actually any modern servlet container uses a pool of Threads to avoid the overhead of creating and destroying them. For example, there is a set of management configuration options in Tomcat:



(from the server.xml config file)

So when a Thread exits the service method, it does not die but is returned to the pool.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: will refresh create new thread
 
Similar Threads
Query about event for refresh button??
refresh a jtable
closing parent window
Adding listeners to Components
Applet dispaly problem