Java Threads - Get running threads

P

Pedro Pinto

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
 
H

Hugo

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

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?
 
A

Arne Vajhøj

Pedro said:
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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top