File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Thread.sleep in servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Thread.sleep in servlet?" Watch "Thread.sleep in servlet?" New topic

Thread.sleep in servlet?

Azrael Noor
Ranch Hand

Joined: Jul 29, 2010
Posts: 384
To keep track of application i have used multithreading in servlet as need was to run program on deploying, so contextlistener is used there. Some unexpected behaviors are facing in jboss 4.0

1) when thread run, it does not stop even server stopped or net beans is close.
2) during application startup servlet run, thread working fine. but when changes done to some class and redeploy is done it does not allow to deploy again.
3) Thread is very bad

Please solve the problem.
Thank you

Azrael Noor
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

What are you trying to achieve with this? Thread.sleep is a very questionable thing to want to be doing in a Servlet.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

Why you are writing code in servlets,BecauseAs per MVC,
Writing code within a servlet is not a good practice,you must have to use the servlet as controller only

SCJP6.0,My blog Ranchers from Delhi
I agree. Here's the link:
subject: Thread.sleep in servlet?
jQuery in Action, 3rd edition