Thread Constructors

Several
constructors are available for creating new Thread instances.
Thread()
Thread(String)
Thread(Runnable)
Thread(Runnable,String)
Thread(ThreadGroup,String)
Thread(ThreadGroup,Runnable)
Thread(ThreadGroup,Runnable,String)
Thread(ThreadGroup,
Runnable, String, long)
ThreadGroup– All
threads belongs to an instance of the ThreadGroup Class. ThreadGroup is used to
represent a group of threads. ThreadGroups can be shown in a hierarchical
manner. There is only one
root ThreadGroup that contains all other thread and groups and each subgroups
can contain other groups and threads. All thread have only one thread group. And
all thread groups (except the root thread group) belongs to exactly one parent
thread group. Threads can access only belonging thread group.
When a new ThreadGroup is created, it
is added as a member of existing ThreadGroup.
If a thread x in group1, and executes the code:
ThreadGroup
group2=new ThreadGroup(“group2”);
Then the newly formed group2 comes
under group1. If you want a parent group other than default then you have to
specify the parent group at the time of creation.
ThreadGroup
group2=new ThreadGroup(group2,“group3”);
Then newly formed group3 comes under
the group2.
Some important methods are:
-
getName() – This method is used to retrieve the name of particular
group.
ThreadGroup g=new
ThreadGroup(“RoseIndia”);
String gname=g.getName(); |
-
getParent() – This method is used to retrieve the name of parent threadgroup of sub group.
| ThreadGroup group=group3.getParent(); |
-
activeGroupCount() – This method returns the number of active thread group in a particular thread group and all its subgroups.
| int size=group.activeGroupCount();
|
-
getThreadGroup() – This method is used to know the thread is belong to which thread group.
| ThreadGroup group=threadx.getThreadGroup(); |

|
Current Comments
7 comments so far (post your own) View All Comments Latest 10 Comments:Have you ever wanted to multiply your camera into several video applications? Usual Windows features do not allow splitting of one videocam into several programs. It's a wrong. Now I need to split video stream from my video into several video applications to talk with my sisters through network. Does anybody know some soft to do this?
Posted by LittleJinaJounes on Wednesday, 09.17.08 @ 13:36pm | #80045
Have you ever wanted to split your video into few video applications? Common Windows abilities do not allow multiplying of one video into several programs. It's a wrong. Now I need to split video stream from my videocam into several video programs to talk with my sisters through www. Does anybody know some soft to do this?
Posted by LittleJinaJounes on Friday, 09.12.08 @ 17:20pm | #78902
I have tried to search something but the search won't return any results. Is there a problem?
Posted by Vaishnavara on Saturday, 08.23.08 @ 20:53pm | #74641
I have tried to search something but the search won't return any results. Is there a problem?
Posted by Vaishnavara on Saturday, 08.23.08 @ 18:05pm | #74620
Hi guys I am new here :P
Posted by SideMeroked on Tuesday, 08.19.08 @ 09:45am | #73698
subj.
How do you think was tha last president elections fair in Russia?
We have a very aggressive debates with admin of <a href=http://nauka-terra.info/>http://nauka-terra.info/</a> on this point...
I want to hear 3rd side....
Posted by WillyThaGrowler on Tuesday, 07.29.08 @ 16:43pm | #69782
<font color=green><b>XRumer 4 Platinum is the best soft for AD and SEO</b></font>
Posted by Hiderhycleree on Sunday, 07.13.08 @ 12:35pm | #67043