[Thread[pool-1-thread-2,5,main] - What does this mean?

Discussion in 'Java' started by Hugo, Mar 26, 2008.

  1. Hugo

    Hugo Guest

    I would like to check concurrency issues in java web application; like
    all developers I did a System.out.println on the current thread:
    [Thread[pool-1-thread-8,5,main]

    Can anyone help me understand what the values in the system.out are?

    I am assuming that:
    1: Is the thread pool number
    8: Is the thread number
    5: I have no clue.

    Are my assumptions correct above?
     
    Hugo, Mar 26, 2008
    #1
    1. Advertising

  2. Hugo

    Daniel Guest

    Re: - What does this mean?

    the third could be method that the thread are running.
    your assumptions seems good. but I can't answer with 100% certainty.


    On 26 Mar, 01:45, Hugo <> wrote:
    > I would like to check concurrency issues in java web application; like
    > all developers I did a System.out.println on the current thread:
    > [Thread[pool-1-thread-8,5,main]
    >
    > Can anyone help me understand what the values in the system.out are?
    >
    > I am assuming that:
    > 1: Is the thread pool number
    > 8: Is the thread number
    > 5: I have no clue.
    >
    > Are my assumptions correct above?
     
    Daniel, Mar 26, 2008
    #2
    1. Advertising

  3. Hugo

    John Maline Guest

    Hugo wrote:
    > I did a System.out.println on the current thread:
    > [Thread[pool-1-thread-8,5,main]
    >
    > Can anyone help me understand what the values in the system.out are?


    What you're seeing is the output of Thread.getName(). Set with
    Thread.setName() or the Thread constructor.

    So it could be anything, depending on what the web app container does.
    It's not specified by the Java language. Talk to the developer of the
    web app container.
     
    John Maline, Mar 26, 2008
    #3
  4. Hugo wrote:
    > I would like to check concurrency issues in java web application; like
    > all developers I did a System.out.println on the current thread:
    > [Thread[pool-1-thread-8,5,main]
    >
    > Can anyone help me understand what the values in the system.out are?


    I'm guessing that it is the following:
    Simple class name (e.g., Thread)
    pool number (1)
    thread number (8)
    priority (5, or Thread.DEFAULT_PRIORITY)
    thread name (main)


    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
     
    Joshua Cranmer, Mar 26, 2008
    #4
  5. Hugo

    Logan Shaw Guest

    Hugo wrote:
    > I would like to check concurrency issues in java web application; like
    > all developers I did a System.out.println on the current thread:
    > [Thread[pool-1-thread-8,5,main]
    >
    > Can anyone help me understand what the values in the system.out are?
    >
    > I am assuming that:
    > 1: Is the thread pool number
    > 8: Is the thread number
    > 5: I have no clue.
    >
    > Are my assumptions correct above?


    As others have said, I don't think there's any spec about this, so
    there's no way to be sure without knowing specific details of the
    system you're on.

    However, I will say this: when I write a toString() method, I often
    include in the output some information which can also be retrieved
    by getWhatever() methods. Are there are any getWhatever() methods
    on Thread that would possibly return an integer with a value of 5?
    It turns out Thread.getId() and Thread.getPriority() both return
    integer values. And Thread.getState() returns an enum, which could
    map to a small integral value. I would try printing out all of
    those alongside your toString() output and seeing if one of them
    mysteriously happens to always correspond to what you see between
    the first and second comma in the toString() output.

    - Logan
     
    Logan Shaw, Mar 27, 2008
    #5
    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. Eric C.
    Replies:
    1
    Views:
    739
    Benjamin Niemann
    Jun 21, 2007
  2. testisok
    Replies:
    0
    Views:
    326
    testisok
    Feb 17, 2009
  3. Rick Lawson
    Replies:
    8
    Views:
    861
    Graham Dumpleton
    Jul 17, 2009
  4. Glazner
    Replies:
    0
    Views:
    374
    Glazner
    Jan 6, 2010
  5. Navin Mishra
    Replies:
    0
    Views:
    213
    Navin Mishra
    Mar 22, 2005
Loading...

Share This Page