This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP, Tomcat and Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP, Tomcat and Threads" Watch "JSP, Tomcat and Threads" New topic
Author

JSP, Tomcat and Threads

Eduardo Mathias
Greenhorn

Joined: Oct 24, 2002
Posts: 17
Is it possible to use threads with JSP and Tomcat ? My web application is based on JSP and JavaBeans accesing database. Now I want to create new threads that should work like agents, interacting with other agents in the same application. Is this possible ? I wonder if the threads will "stay alive" even after the jsp page or bean that created it has finished executing ! Please, any help is welcome !
Eduardo.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12671
    
    5
Yes you can do anything in a servlet (or JSP) that a free-standing Java application can do (subject to possible security control by the servlet engine). There is nothing magic about the servlet environment that changes the way Threads operate.
I have used separate Threads to manage sending email, load headlines from another site, etc.
You do have to think very carefully about synchronization issues,etc - keeping in mind at all times that your JSP may be handling multiple requests "at the same time."
Bill


Java Resources at www.wbrogden.com
Eduardo Mathias
Greenhorn

Joined: Oct 24, 2002
Posts: 17
Thank's a lot for the tip !
I'll try to develop a little example in order to validate my model !
Eduardo.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP, Tomcat and Threads
 
Similar Threads
Calling JSP from ASP
SCEA Part 2 question (Fly By Night assignment)
Effect of 10,000 thread creation on Application performance
Help me reducing JTABLE loading time..
Inside JVM Discussion.