Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Hugo - 26 Mar 2008 01:45 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 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.