Java Threads - Get running threads

Discussion in 'Java' started by Pedro Pinto, Apr 8, 2008.

  1. Pedro Pinto

    Pedro Pinto Guest

    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
     
    Pedro Pinto, Apr 8, 2008
    #1
    1. Advertising

  2. Pedro Pinto

    Hugo Guest

    On Apr 8, 2:42 am, Pedro Pinto <> wrote:
    > 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?
     
    Hugo, Apr 8, 2008
    #2
    1. Advertising

  3. Pedro Pinto

    Arne Vajhøj Guest

    Pedro Pinto wrote:
    > 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
     
    Arne Vajhøj, Apr 9, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    9
    Views:
    472
    Harish
    Jan 12, 2005
  2. Jason
    Replies:
    5
    Views:
    1,316
    Jason
    Nov 20, 2006
  3. Lew
    Replies:
    0
    Views:
    388
  4. Real Gagnon
    Replies:
    0
    Views:
    461
    Real Gagnon
    Oct 6, 2012
  5. Skellington
    Replies:
    1
    Views:
    311
    Robert Klemme
    Dec 11, 2012
Loading...

Share This Page