Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

thread ID setting

Hi,

I am working on below example
http://www.avajava.com/tutorials/lessons/how-do-i-identify-a-thread.html

I have not seen author setting thread ID anywhere. Where it is getting set.


i see output as below

RunnableJob is being run by thread1 (9)
RunnableJob is being run by Thread-1 (11)
Main thread: main(1)
RunnableJob is being run by thread2 (10)

which line is printing below output
RunnableJob is being run by Thread-1 (11)
please advise
Any links resources ideas highly appreciated. Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of CPColin
CPColin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of dpearson
dpearson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

It's thread3, with the default thread name


which is Default thread?
I see main thread and thread1 and thread2 in the code. Where from default thread is coming in this example.

Specifically it's being set here in the constructor for Thread:


How to check which specific constructor it is setting from
Please advise
which is Default thread?

When I said "default thread name," I meant "the name that is assigned to threads, by default." There is no such thing as a "default thread."
Avatar of gudii9

ASKER

Default thread is below thread in the code right?
Thread thread3 = new Thread(runnableJob);
            thread3.start();


Please advise
There is no such thing as a "default thread."

In that code, that thread is being assigned a default name, because you didn't specify one. That's what dpearson and I were talking about on Friday.