Java Doc for ThreadGroup.java in  » 6.0-JDK-Modules » j2me » java » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.lang 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.lang.ThreadGroup

All known Subclasses:   sun.applet.AppletThreadGroup,
ThreadGroup
public class ThreadGroup (Code)
A thread group represents a set of threads. In addition, a thread group can also include other thread groups. The thread groups form a tree in which every thread group except the initial thread group has a parent.

A thread is allowed to access information about its own thread group, but not to access information about its thread group's parent thread group or any other thread groups.
author:
   unascribed
version:
   1.55 07/27/01
since:
   JDK1.0



Field Summary
 booleandaemon
    
 booleandestroyed
    
 ThreadGroupgroups
    
 intmaxPriority
    
 intnUnstartedThreads
    
 Stringname
    
 intngroups
    
 intnthreads
    
 ThreadGroupparent
    
 Threadthreads
    
 booleanvmAllowSuspension
    

Constructor Summary
 ThreadGroup()
     Creates an empty Thread group that is not in any Thread group.
public  ThreadGroup(String name)
     Constructs a new thread group.
public  ThreadGroup(ThreadGroup parent, String name)
     Creates a new thread group.

Method Summary
public  intactiveCount()
     Returns an estimate of the number of active threads in this thread group.
public  intactiveGroupCount()
     Returns an estimate of the number of active groups in this thread group.
 voidadd(Thread t)
     Adds the specified Thread to this group.
 voidaddUnstarted()
     Increments the count of unstarted threads in the thread group.
final public  voidcheckAccess()
     Determines if the currently running thread has permission to modify this thread group.
final public  voiddestroy()
     Destroys this thread group and all of its subgroups.
public  intenumerate(Thread list)
     Copies into the specified array every active thread in this thread group and its subgroups.
public  intenumerate(Thread list, boolean recurse)
     Copies into the specified array every active thread in this thread group.
public  intenumerate(ThreadGroup list)
     Copies into the specified array references to every active subgroup in this thread group.
public  intenumerate(ThreadGroup list, boolean recurse)
     Copies into the specified array references to every active subgroup in this thread group.
final public  intgetMaxPriority()
     Returns the maximum priority of this thread group.
final public  StringgetName()
     Returns the name of this thread group.
final public  ThreadGroupgetParent()
     Returns the parent of this thread group.

First, if the parent is not null, the checkAccess method of the parent thread group is called with no arguments; this may result in a security exception.

final public  voidinterrupt()
     Interrupts all threads in this thread group.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

final public  booleanisDaemon()
     Tests if this thread group is a daemon thread group.
public synchronized  booleanisDestroyed()
     Tests if this thread group has been destroyed.
public  voidlist()
     Prints information about this thread group to the standard output.
 voidlist(PrintStream out, int indent)
    
final public  booleanparentOf(ThreadGroup g)
     Tests if this thread group is either the thread group argument or one of its ancestor thread groups.
 voidremove(Thread t)
     Removes the specified Thread from this group.
final public  voidsetDaemon(boolean daemon)
     Changes the daemon status of this thread group.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

final public  voidsetMaxPriority(int pri)
     Sets the maximum priority of the group.
public  StringtoString()
     Returns a string representation of this Thread group.
public  voiduncaughtException(Thread t, Throwable e)
     Called by the Java Virtual Machine when a thread in this thread group stops because of an uncaught exception.

Field Detail
daemon
boolean daemon(Code)



destroyed
boolean destroyed(Code)



groups
ThreadGroup groups(Code)



maxPriority
int maxPriority(Code)



nUnstartedThreads
int nUnstartedThreads(Code)



name
String name(Code)



ngroups
int ngroups(Code)



nthreads
int nthreads(Code)



parent
ThreadGroup parent(Code)



threads
Thread threads(Code)



vmAllowSuspension
boolean vmAllowSuspension(Code)




Constructor Detail
ThreadGroup
ThreadGroup()(Code)
Creates an empty Thread group that is not in any Thread group. This method is used to create the system Thread group.



ThreadGroup
public ThreadGroup(String name)(Code)
Constructs a new thread group. The parent of this new group is the thread group of the currently running thread.

The checkAccess method of the parent thread group is called with no arguments; this may result in a security exception.
Parameters:
  name - the name of the new thread group.
exception:
  SecurityException - if the current thread cannot create athread in the specified thread group.
See Also:   java.lang.ThreadGroup.checkAccess
since:
   JDK1.0




ThreadGroup
public ThreadGroup(ThreadGroup parent, String name)(Code)
Creates a new thread group. The parent of this new group is the specified thread group.

The checkAccess method of the parent thread group is called with no arguments; this may result in a security exception.
Parameters:
  parent - the parent thread group.
Parameters:
  name - the name of the new thread group.
exception:
  NullPointerException - if the thread group argument isnull.
exception:
  SecurityException - if the current thread cannot create athread in the specified thread group.
See Also:   java.lang.SecurityException
See Also:   java.lang.ThreadGroup.checkAccess
since:
   JDK1.0





Method Detail
activeCount
public int activeCount()(Code)
Returns an estimate of the number of active threads in this thread group. the number of active threads in this thread group and in anyother thread group that has this thread group as an ancestor.
since:
   JDK1.0



activeGroupCount
public int activeGroupCount()(Code)
Returns an estimate of the number of active groups in this thread group. the number of active thread groups with this thread group asan ancestor.
since:
   JDK1.0



add
void add(Thread t)(Code)
Adds the specified Thread to this group.
Parameters:
  t - the Thread to be added
exception:
  IllegalThreadStateException - If the Thread group has been destroyed.



addUnstarted
void addUnstarted()(Code)
Increments the count of unstarted threads in the thread group. Unstarted threads are not added to the thread group so that they can be collected if they are never started, but they must be counted so that daemon thread groups with unstarted threads in them are not destroyed.



checkAccess
final public void checkAccess()(Code)
Determines if the currently running thread has permission to modify this thread group.

If there is a security manager, its checkAccess method is called with this thread group as its argument. This may result in throwing a SecurityException.
exception:
  SecurityException - if the current thread is not allowed toaccess this thread group.
See Also:   java.lang.SecurityManager.checkAccess(java.lang.ThreadGroup)
since:
   JDK1.0




destroy
final public void destroy()(Code)
Destroys this thread group and all of its subgroups. This thread group must be empty, indicating that all threads that had been in this thread group have since stopped.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.
exception:
  IllegalThreadStateException - if the thread group is notempty or if the thread group has already been destroyed.
exception:
  SecurityException - if the current thread cannot modify thisthread group.
See Also:   java.lang.ThreadGroup.checkAccess
since:
   JDK1.0




enumerate
public int enumerate(Thread list)(Code)
Copies into the specified array every active thread in this thread group and its subgroups.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

An application should use the activeCount method to get an estimate of how big the array should be. If the array is too short to hold all the threads, the extra threads are silently ignored.
Parameters:
  list - an array into which to place the list of threads. the number of threads put into the array.
exception:
  SecurityException - if the current thread does nothave permission to enumerate this thread group.
See Also:   java.lang.ThreadGroup.activeCount
See Also:   java.lang.ThreadGroup.checkAccess
since:
   JDK1.0




enumerate
public int enumerate(Thread list, boolean recurse)(Code)
Copies into the specified array every active thread in this thread group. If the recurse flag is true, references to every active thread in this thread's subgroups are also included. If the array is too short to hold all the threads, the extra threads are silently ignored.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

An application should use the activeCount method to get an estimate of how big the array should be.
Parameters:
  list - an array into which to place the list of threads.
Parameters:
  recurse - a flag indicating whether also to include threadsin thread groups that are subgroups of thisthread group. the number of threads placed into the array.
exception:
  SecurityException - if the current thread does nothave permission to enumerate this thread group.
See Also:   java.lang.ThreadGroup.activeCount
See Also:   java.lang.ThreadGroup.checkAccess
since:
   JDK1.0




enumerate
public int enumerate(ThreadGroup list)(Code)
Copies into the specified array references to every active subgroup in this thread group.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

An application should use the activeGroupCount method to get an estimate of how big the array should be. If the array is too short to hold all the thread groups, the extra thread groups are silently ignored.
Parameters:
  list - an array into which to place the list of thread groups. the number of thread groups put into the array.
exception:
  SecurityException - if the current thread does nothave permission to enumerate this thread group.
See Also:   java.lang.ThreadGroup.activeGroupCount
See Also:   java.lang.ThreadGroup.checkAccess
since:
   JDK1.0




enumerate
public int enumerate(ThreadGroup list, boolean recurse)(Code)
Copies into the specified array references to every active subgroup in this thread group. If the recurse flag is true, references to all active subgroups of the subgroups and so forth are also included.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

An application should use the activeGroupCount method to get an estimate of how big the array should be.
Parameters:
  list - an array into which to place the list of threads.
Parameters:
  recurse - a flag indicating whether to recursively enumerateall included thread groups. the number of thread groups put into the array.
exception:
  SecurityException - if the current thread does nothave permission to enumerate this thread group.
See Also:   java.lang.ThreadGroup.activeGroupCount
See Also:   java.lang.ThreadGroup.checkAccess
since:
   JDK1.0




getMaxPriority
final public int getMaxPriority()(Code)
Returns the maximum priority of this thread group. Threads that are part of this group cannot have a higher priority than the maximum priority. the maximum priority that a thread in this thread groupcan have.
See Also:   ThreadGroup.setMaxPriority
since:
   JDK1.0



getName
final public String getName()(Code)
Returns the name of this thread group. the name of this thread group.
since:
   JDK1.0



getParent
final public ThreadGroup getParent()(Code)
Returns the parent of this thread group.

First, if the parent is not null, the checkAccess method of the parent thread group is called with no arguments; this may result in a security exception. the parent of this thread group. The top-level thread groupis the only thread group whose parent is null.
exception:
  SecurityException - if the current thread cannot modifythis thread group.
See Also:   java.lang.ThreadGroup.checkAccess
See Also:   java.lang.SecurityException
See Also:   java.lang.RuntimePermission
since:
   JDK1.0




interrupt
final public void interrupt()(Code)
Interrupts all threads in this thread group.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

This method then calls the interrupt method on all the threads in this thread group and in all of its subgroups.
exception:
  SecurityException - if the current thread is not allowedto access this thread group or any of the threads inthe thread group.
See Also:   java.lang.Thread.interrupt
See Also:   java.lang.SecurityException
See Also:   java.lang.ThreadGroup.checkAccess
since:
   1.2




isDaemon
final public boolean isDaemon()(Code)
Tests if this thread group is a daemon thread group. A daemon thread group is automatically destroyed when its last thread is stopped or its last thread group is destroyed. true if this thread group is a daemon thread group;false otherwise.
since:
   JDK1.0



isDestroyed
public synchronized boolean isDestroyed()(Code)
Tests if this thread group has been destroyed. true if this object is destroyed
since:
   JDK1.1



list
public void list()(Code)
Prints information about this thread group to the standard output. This method is useful only for debugging.
since:
   JDK1.0



list
void list(PrintStream out, int indent)(Code)



parentOf
final public boolean parentOf(ThreadGroup g)(Code)
Tests if this thread group is either the thread group argument or one of its ancestor thread groups.
Parameters:
  g - a thread group. true if this thread group is the thread groupargument or one of its ancestor thread groups;false otherwise.
since:
   JDK1.0



remove
void remove(Thread t)(Code)
Removes the specified Thread from this group.
Parameters:
  t - the Thread to be removed if the Thread has already been destroyed.



setDaemon
final public void setDaemon(boolean daemon)(Code)
Changes the daemon status of this thread group.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

A daemon thread group is automatically destroyed when its last thread is stopped or its last thread group is destroyed.
Parameters:
  daemon - if true, marks this thread group asa daemon thread group; otherwise, marks thisthread group as normal.
exception:
  SecurityException - if the current thread cannot modifythis thread group.
See Also:   java.lang.SecurityException
See Also:   java.lang.ThreadGroup.checkAccess
since:
   JDK1.0




setMaxPriority
final public void setMaxPriority(int pri)(Code)
Sets the maximum priority of the group. Threads in the thread group that already have a higher priority are not affected.

First, the checkAccess method of this thread group is called with no arguments; this may result in a security exception.

If the pri argument is less than Thread.MIN_PRIORITY or greater than Thread.MAX_PRIORITY , the maximum priority of the group remains unchanged.

Otherwise, the priority of this ThreadGroup object is set to the smaller of the specified pri and the maximum permitted priority of the parent of this thread group. (If this thread group is the system thread group, which has no parent, then its maximum priority is simply set to pri.) Then this method is called recursively, with pri as its argument, for every thread group that belongs to this thread group.
Parameters:
  pri - the new priority of the thread group.
exception:
  SecurityException - if the current thread cannot modifythis thread group.
See Also:   ThreadGroup.getMaxPriority
See Also:   java.lang.SecurityException
See Also:   java.lang.ThreadGroup.checkAccess
since:
   JDK1.0




toString
public String toString()(Code)
Returns a string representation of this Thread group. a string representation of this thread group.
since:
   JDK1.0



uncaughtException
public void uncaughtException(Thread t, Throwable e)(Code)
Called by the Java Virtual Machine when a thread in this thread group stops because of an uncaught exception.

The uncaughtException method of ThreadGroup does the following:

  • If this thread group has a parent thread group, the uncaughtException method of that parent is called with the same two arguments.
  • Otherwise, this method determines if the Throwable argument is an instance of ThreadDeath. If so, nothing special is done. Otherwise, the Throwable's printStackTrace method is called to print a stack backtrace to the standard error stream.

Applications can override this method in subclasses of ThreadGroup to provide alternative handling of uncaught exceptions.
Parameters:
  t - the thread that is about to exit.
Parameters:
  e - the uncaught exception.
See Also:   java.lang.System.err
See Also:   java.lang.ThreadDeath
See Also:   java.lang.Throwable.printStackTrace(java.io.PrintStream)
since:
   JDK1.0




Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.