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();
Popular Posts
-
______________________________________________________________ Posted by Super Hot Figure Read More... [Source: Super Hot Figure - Posted...
-
Anora Semiconductor Labs Pvt Ltd Subject: Looking for Engineers in Silicon Validation Position: Product Development Enginee...
-
Builds custom Facebook fan pages for large and small businesses. Need to buy Facebook fans or Facebook likes Buy Cheap and Real Fac...
-
Job Portal: Conflate Solutions - Java/J2EE Developer
-
Mahindra Satyam Off Campus Recruitment for 2009 & 2010 passouts | BE/Btech & MCA hiring | Last Date 10 March 2011 Campus Drive...
-
Location: Hyderabad Eligibility: • Qualification - B.E, B.Tech, M.C.A and M.Sc in any stream with First class. • Should have knowledge i...
-
FYI Capgemini will be conducting Open Campus Recuritment Programme for 2009 and 2010 passout students in Hyderabad on 24th Februa...
-
Job Position : Credit Underwriter Experience : 0 – 2 Years Qualification : M.A,MBA/PGDM Job Location : Chennai Job Responsibilities : * A...
-
Método Dinheiro O artigo detalha a seguir o meu top 10 pessoal métodos de ganhar dinheiro com a Internet. Método Dinheiro ...
-
test politics
Powered by Blogger.
0 comments: