< prev index next >

src/java.rmi/share/classes/sun/rmi/runtime/NewThreadAction.java

Print this page

 38  * prefixed with "RMI "), and whether or not it will be a daemon
 39  * thread.
 40  *
 41  * The new thread may be created in the system thread group (the root
 42  * of the thread group tree) or an internally created non-system
 43  * thread group, as specified at construction of this class.
 44  *
 45  * The new thread will have the system class loader as its initial
 46  * context class loader (that is, its context class loader will NOT be
 47  * inherited from the current thread).
 48  *
 49  * @author      Peter Jones
 50  **/
 51 public final class NewThreadAction implements PrivilegedAction<Thread> {
 52 
 53     /** cached reference to the system (root) thread group */
 54     @SuppressWarnings("removal")
 55     static final ThreadGroup systemThreadGroup =
 56         AccessController.doPrivileged(new PrivilegedAction<ThreadGroup>() {
 57             public ThreadGroup run() {

 58                 ThreadGroup group = Thread.currentThread().getThreadGroup();
 59                 ThreadGroup parent;
 60                 while ((parent = group.getParent()) != null) {
 61                     group = parent;
 62                 }
 63                 return group;
 64             }
 65         });
 66 
 67     /**
 68      * special child of the system thread group for running tasks that
 69      * may execute user code, so that the security policy for threads in
 70      * the system thread group will not apply
 71      */
 72     @SuppressWarnings("removal")
 73     static final ThreadGroup userThreadGroup =
 74         AccessController.doPrivileged(new PrivilegedAction<ThreadGroup>() {
 75             public ThreadGroup run() {
 76                 return new ThreadGroup(systemThreadGroup, "RMI Runtime");
 77             }
 78         });
 79 
 80     private final ThreadGroup group;
 81     private final Runnable runnable;
 82     private final String name;
 83     private final boolean daemon;
 84 
 85     NewThreadAction(ThreadGroup group, Runnable runnable,
 86                     String name, boolean daemon)
 87     {
 88         this.group = group;
 89         this.runnable = runnable;
 90         this.name = name;
 91         this.daemon = daemon;
 92     }

 38  * prefixed with "RMI "), and whether or not it will be a daemon
 39  * thread.
 40  *
 41  * The new thread may be created in the system thread group (the root
 42  * of the thread group tree) or an internally created non-system
 43  * thread group, as specified at construction of this class.
 44  *
 45  * The new thread will have the system class loader as its initial
 46  * context class loader (that is, its context class loader will NOT be
 47  * inherited from the current thread).
 48  *
 49  * @author      Peter Jones
 50  **/
 51 public final class NewThreadAction implements PrivilegedAction<Thread> {
 52 
 53     /** cached reference to the system (root) thread group */
 54     @SuppressWarnings("removal")
 55     static final ThreadGroup systemThreadGroup =
 56         AccessController.doPrivileged(new PrivilegedAction<ThreadGroup>() {
 57             public ThreadGroup run() {
 58                 @SuppressWarnings("deprecation")
 59                 ThreadGroup group = Thread.currentThread().getThreadGroup();
 60                 ThreadGroup parent;
 61                 while ((parent = group.getParent()) != null) {
 62                     group = parent;
 63                 }
 64                 return group;
 65             }
 66         });
 67 
 68     /**
 69      * special child of the system thread group for running tasks that
 70      * may execute user code, so that the security policy for threads in
 71      * the system thread group will not apply
 72      */
 73     @SuppressWarnings({"deprecation", "removal"})
 74     static final ThreadGroup userThreadGroup =
 75         AccessController.doPrivileged(new PrivilegedAction<ThreadGroup>() {
 76             public ThreadGroup run() {
 77                 return new ThreadGroup(systemThreadGroup, "RMI Runtime");
 78             }
 79         });
 80 
 81     private final ThreadGroup group;
 82     private final Runnable runnable;
 83     private final String name;
 84     private final boolean daemon;
 85 
 86     NewThreadAction(ThreadGroup group, Runnable runnable,
 87                     String name, boolean daemon)
 88     {
 89         this.group = group;
 90         this.runnable = runnable;
 91         this.name = name;
 92         this.daemon = daemon;
 93     }
< prev index next >