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
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.