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. Advertisements

  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. Advertisements

  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. Advertisements

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. Renato Battaglia
    Replies:
    3
    Views:
    3,013
    Jon Skeet
    Oct 24, 2003
  2. vnssoftware
    Replies:
    0
    Views:
    574
    vnssoftware
    Aug 12, 2004
  3. Replies:
    9
    Views:
    614
    Harish
    Jan 12, 2005
  4. Replies:
    1
    Views:
    823
    Raymond DeCampo
    Jul 28, 2005
  5. Jason
    Replies:
    5
    Views:
    1,448
    Jason
    Nov 20, 2006
  6. Replies:
    3
    Views:
    746
    Daniel Pitts
    Jan 3, 2007
  7. Shadow123
    Replies:
    1
    Views:
    494
    Shadow123
    Jul 9, 2008
  8. Skellington
    Replies:
    1
    Views:
    409
    Robert Klemme
    Dec 11, 2012
Loading...