Hi,

it's often required to manual activate scopes in a async threads/runnables
if you don't use JavaEE 7.
I already used this in 3-4 projects in the last 3 years.

My current API looks like:

CdiManagedRunnable - A abstract class with implements Runnable and starts
the RequestScoped via ContextControl and a new scope called ThreadScope
RequestScoped is optional, CdiManagedRunnable#isRequestScopedSupported
return false per default and can be overwritten by the user.

ThreadContext - A AbstractContext implementation which a static static
ThreadLocal<ContextualStorage>

ThreadContextExtension
ThreadScoped

WDYT? Is this useful for other people too?

Regards,
Thomas

Reply via email to