[weld-dev] clarification of AfterDeploymentValidation

Pete Muir pmuir at redhat.com
Sat Jan 15 05:47:47 EST 2011


This needs addressing in the Java EE spec, not CDI. Due to the structure of EE/CDI, CDI cannot send events that relate to overall app startup.

Can you send Roberto Chinnici an email?

On 14 Jan 2011, at 21:57, Mark Struberg wrote:

> Hi Dan!
> 
> The trick with the servlet is neat ;)
> 
>> If you want to know when CDI is done starting up and when application-
>> scoped beans are available, that's the AfterDeploymentValidation event.
> Oki, this might work in Weld and in OWB, but does the Spec really forces this for any other container too? In other words: can a developer of an Extension _really_ count on it?
> 
> I also believe it is ambiguous, so should I file a CDI spec clarification issue?

I don't think it's particularly ambiguous (no beans beyond the BeanManager are required to be available in container lifecycle events, this is covered in 11.5

"Service providers may have observer methods, which may observe any event, including any container lifecycle event, and obtain an injected BeanManager reference"

But we could improve that sentence to say ", no other beans are available for injection".

> 
> txs and LieGrue,
> strub
> 
> 
> --- On Fri, 1/14/11, Dan Allen <dan.j.allen at gmail.com> wrote:
> 
> From: Dan Allen <dan.j.allen at gmail.com>
> Subject: Re: [weld-dev] clarification of AfterDeploymentValidation
> To: "Mark Struberg" <struberg at yahoo.de>
> Cc: weld-dev at lists.jboss.org
> Date: Friday, January 14, 2011, 9:18 PM
> 
> I've actually had this exact same dilemma in Seam. I want to know when everything is ready. So it really depends on how you define after (or started)
> If you want to know when CDI is done starting up and when application-scoped beans are available, that's the AfterDeploymentValidation event. However, I also believe that this sounds too ambiguous. You have to know that deployment validation is the last phase to know that the CDI beans are ready.
> 
> 
> Then there is the question of "when is the module deployed?" (module meaning web archive, for instance). It amazes me that there is no definitive event in Java EE for this. I've hacked around this in Seam by registering a Servlet with a very low priority and fire an event in the init() method.
> 
> 
> https://github.com/seam/servlet/blob/master/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridgeServlet.java
> 
> 
> I consider that a design requirement for EE 7.
> 
> -Dan
> 
> On Fri, Jan 14, 2011 at 16:09, Mark Struberg <struberg at yahoo.de> wrote:
> 
> 
> Hi!
> 
> 
> 
> I need to trigger a task once the whole CDI container got started, and I'm not sure  if the AfterDeploymentValidation can be used for this. Basically what I like to do is to warm-up & initialise CDI based services when the server has been started.
> 
> 
> 
> 
> 
> The AfterDeploymentValidation system event is defined as:
> 
> 
> 
> "The container must fire a third event after it has validated that there are no deployment problems and before creating contexts or processing requests."
> 
> 
> 
> Thus especially the part "before creating contexts" is a bit unclear. Does this mean that no @ApplicationScoped, etc beans are available yet in this phase?
> 
> 
> 
> If so, do we like to introduce a new AfterServerStart event?
> 
> 
> 
> LieGrue,
> 
> strub
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 
> weld-dev mailing list
> 
> weld-dev at lists.jboss.org
> 
> https://lists.jboss.org/mailman/listinfo/weld-dev
> 
> 
> 
> 
> -- 
> Dan AllenPrincipal Software Engineer, Red Hat | Author of Seam in Action
> Registered Linux User #231597
> 
> http://mojavelinux.com
> 
> 
> http://mojavelinux.com/seaminaction
> http://www.google.com/profiles/dan.j.allen
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev




More information about the weld-dev mailing list