Concurrency utilities, in most part adapted or taken literally from
dl.util.concurrent library by Doug Lea and partially modified to match the
incoming JDK 1.5 java.util.concurrent package. This package contains a
subset of java.util.concurrent functionality; however, it adds several
extensions, mostly security related:
- Implementation of unbounded blocking queue using arrays:
{@link edu.emory.mathcs.util.concurrent.DynamicArrayBlockingQueue}
- {@link edu.emory.mathcs.util.concurrent.ThreadContext} and
{@link edu.emory.mathcs.util.concurrent.DelegatableThreadLocal}s
which together allow to
store/restore and temporarily delegate thread state, including thread
locals and context class loaders, to worker threads in thread pools
- {@link edu.emory.mathcs.util.concurrent.ExecutorUtils#delegatedRunnable},
encapsulating Runnable together with the creator's
access control context and thread context, allows to create and
execute asynchronous tasks with retained security context and thread state.
That is, it ensures that the runnable will be executed within
exactly the same security context and thread state as when it was created,
even though by a different thread.
- {@link edu.emory.mathcs.util.concurrent.ExecutorUtils#safeThreadFactory}:
In comparison to the factories from the original dl.u.c, and the factories
used in JDK 1.5, this one ensures a security consistency:
threads are created within the thread context and access control context
of the pool creator rather than that of the (rather random) thread pool
client. It ensures that all threads within the pool have identical security
properties and state.
- {@link edu.emory.mathcs.util.concurrent.SecureThreadPoolExecutor} enforces
even stricter context propagation, ensuring
that tasks are running within the context of the client that submitted them.
The most prominent use of these extensions is in the middleware systems, where
it is not uncommon for separate executable actions to run with different access
permissions, depending on the identity of a subject that requested them.