[cdi-dev] CDI-30 - Creating a managed context

John D. Ament john.d.ament at gmail.com
Sat Jun 25 10:10:46 EDT 2016


I have the flip side of this change available as well.


In this version, activation is done directly from BeanManager instead of
the secondary context object.  I'm also thinking with this commit that
ManagedContext should actually be "UnmanagedContext" to clarify that its
not being handled in the container.


PS - One of the use cases I put in the JIRA ticket was around quartz
integration.  This is what the resulting integration looks like

    public class CDIJobListener implements JobListener {

        public static final String CONTEXT_NAME =

        public String getName() {
            return "cdi";

        public void jobToBeExecuted(JobExecutionContext
jobExecutionContext) {
            BeanManager beanManager = CDI.current().getBeanManager();
            ManagedContext requestContext =

        public void jobExecutionVetoed(JobExecutionContext
jobExecutionContext) {
            ManagedContext managedContext =

        public void jobWasExecuted(JobExecutionContext jobExecutionContext,
JobExecutionException e) {

On Fri, Jun 24, 2016 at 5:28 PM John D. Ament <john.d.ament at gmail.com>

> All,
> One of the discussion points from today was around where activation
> belongs.  I pushed up a branch with a rough example of what this might look
> like
> https://github.com/johnament/cdi/commit/f4cb91dca0eeb7edef5d4238f55ca413a0711e26
> One of my concerns with doing this is that to get a context object from
> the bean manager, it needs to be active.  This is in the javadocs: Obtains
> an active {@linkplain javax.enterprise.context.spi.Context context object}
> for the given.  If we change this, it risks breaking compatibility.
> Let me know your thoughts.
> John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20160625/6b53a9b2/attachment.html 

More information about the cdi-dev mailing list