Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

Java Threads - Get running threads

Thread view: 
Pedro Pinto - 08 Apr 2008 10:42 GMT
Hy there,

I'm building an application that creates a thread. This thread creates
other threads to perform several tasks.

My question is simple. Being this main thread created in a JSP page,
and still running after the user logs out, how can i get the current
status of the thread? I would like for the user, when he logs on the
application, to verify if the thread is active, that is, the current
status.

I can't seem to be able to get the thread once it is initialized.

Thanks in advance for any help.

Regards

Pedro Pinto
Hugo - 08 Apr 2008 19:06 GMT
> Hy there,
>
[quoted text clipped - 14 lines]
>
> Pedro Pinto

Hi Pedro:

I am not sure if I completely understand your questions.

Examples of thread details that can be listed are:

Thread.getName(), Thread.isAlive() etc; further info at:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html

Why do you want to show the use the status of the thread?
Arne Vajhøj - 09 Apr 2008 00:44 GMT
> I'm building an application that creates a thread. This thread creates
> other threads to perform several tasks.
[quoted text clipped - 6 lines]
>
> I can't seem to be able to get the thread once it is initialized.

You need to store a reference to the thread somewhere.

Like saving it in application with username as key.

BTW, it is very bad practice to have JSP pages start threads.

Arne
Lew - 09 Apr 2008 00:57 GMT
> BTW, it is very bad practice to have JSP pages start threads.

Excellent point.  In fact, it's somewhat bad practice to have any explicit
Java scriptlet in a JSP.  It is better to refactor it according to what Sun
calls the "Model 2" model-view-controller (MVC) architecture, by hand or with
Struts, or to use JSF which implements a full-scale MVC pattern via its
backing beans.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.