com.sun.jini.thread
Class GetThreadPoolAction

java.lang.Object
  extended by com.sun.jini.thread.GetThreadPoolAction
All Implemented Interfaces:
PrivilegedAction

public final class GetThreadPoolAction
extends Object
implements PrivilegedAction

Provides security-checked access to internal thread pools as a java.security.PrivilegedAction, to be used conveniently with an AccessController.doPrivileged or Security.doPrivileged. There are two internal thread pools: one of threads in the system thread group, for executing tasks to be guarded by the security policy for the system thread group, and one of threads in a non-system thread group, for executing tasks with user code that should not be restricted by that policy. If there is a security manager, the run method will check the ThreadPoolPermission for the requested thread pool. If used with a doPrivileged (the typical case), then only the protection domain of the immediate caller of the doPrivileged needs the permission. The thread pools execute an action in a thread without the security context in which the execute method was invoked, without any subject, and with the system class loader as the context class loader. Actions are expected to complete with the same context class loader and other thread-specific state (such as priority) that they were started with.

Author:
Sun Microsystems, Inc.

Field Summary
private static Permission getSystemThreadPoolPermission
           
private static Permission getUserThreadPoolPermission
           
private static ThreadPool systemThreadPool
          pool of threads for executing tasks in system thread group
private  boolean user
           
private static ThreadPool userThreadPool
          pool of threads for executing tasks with user code
 
Constructor Summary
GetThreadPoolAction(boolean user)
          Creates an action that will obtain an internal thread pool.
 
Method Summary
 Object run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

systemThreadPool

private static final ThreadPool systemThreadPool
pool of threads for executing tasks in system thread group


userThreadPool

private static final ThreadPool userThreadPool
pool of threads for executing tasks with user code


getSystemThreadPoolPermission

private static final Permission getSystemThreadPoolPermission

getUserThreadPoolPermission

private static final Permission getUserThreadPoolPermission

user

private final boolean user
Constructor Detail

GetThreadPoolAction

public GetThreadPoolAction(boolean user)
Creates an action that will obtain an internal thread pool. When run, this action verifies that the current access control context has permission to access the thread group used by the indicated pool.

Parameters:
user - if true, will obtain the non-system thread group pool for executing user code; if false, will obtain the system thread group pool
Method Detail

run

public Object run()
Specified by:
run in interface PrivilegedAction


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.