Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
 
 
Search All Tutorials
  

 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

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)

        

ThreadGroupAll 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();

      

                         

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

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

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.