File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "will refresh create new thread" Watch "will refresh create new thread" New topic

will refresh create new thread

tejo kartheek

Joined: Feb 04, 2008
Posts: 13
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

Joined: May 16, 2003
Posts: 25


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 -
Dont wait for forum answers
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
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.

I agree. Here's the link:
subject: will refresh create new thread
It's not a secret anymore!