Inter-Thread Signaling Using BooleanLock

Appendix B - The ThreadGroup API

Java Thread Programming
Paul Hyde
  Copyright 1999 Sams Publishing

Appendix B: The ThreadGroup API
Overview
This appendix summarizes the public and protected members of the ThreadGroup class. It is based on Sun Microsystems Java Development Kit 1.2. Information has been combined from Suns API documentation, source code, reflection on the distributed classes, and the Java Language Specification .
Many of the methods and both of the constructors can throw a SecurityException . SecurityException is a subclass of RuntimeException , so try / catch blocks are not required for any of the methods of ThreadGroup that might throw it. By default, an application does not have a SecurityManager defined (using JDK 1.0, 1.1, or 1.2 from Sun Microsystems). An applet, on the other hand, might have a SecurityManager present. In general, this exception is thrown when the calling thread is not permitted to perform the requested action. Many times, the security check is done by invoking the checkAccess() method on ThreadGroup , which in turn checks to see if a SecurityManager has been installed, and if so, invokes its checkAccess(ThreadGroup) method. For most of your application programming, you can safely ignore the possibility of a SecurityException being thrown.
Throughout this appendix, the terms this thread and current thread are used. The current thread term refers to the thread that invoked the method. The this thread term refers to the Thread instance that the method will affect. For example, suppose threadA executes the following statement:
threadB.checkAccess();
threadA would be considered the current thread, and threadB would be considered this thread. The API documentation for checkAccess() would read something like, throws a SecurityException if the current thread is not permitted to access this thread . This translates to throws a SecurityException if threadA is not permitted to access threadB . Its a subtle difference worth noticing.

Toc


Java Thread Programming
Java Thread Programming
ISBN: 0672315858
EAN: 2147483647
Year: 2005
Pages: 149
Authors: Paul Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net