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 - 26 Mar 2008 12:19 GMT
the third could be method that the thread are running.
your assumptions seems good. but I can't answer with 100% certainty.
> I would like to check concurrency issues in java web application; like
> all developers I did a System.out.println on the current thread:
[quoted text clipped - 8 lines]
>
> Are my assumptions correct above?
John Maline - 26 Mar 2008 16:31 GMT
> 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.
Joshua Cranmer - 26 Mar 2008 21:56 GMT
> 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)

Signature
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Logan Shaw - 27 Mar 2008 02:42 GMT
> I would like to check concurrency issues in java web application; like
> all developers I did a System.out.println on the current thread:
[quoted text clipped - 8 lines]
>
> 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