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?
txs and LieGrue,
strub
--- On Fri, 1/14/11, Dan Allen <dan.j.allen(a)gmail.com> wrote:
From: Dan Allen <dan.j.allen(a)gmail.com>
Subject: Re: [weld-dev] clarification of AfterDeploymentValidation
To: "Mark Struberg" <struberg(a)yahoo.de>
Cc: weld-dev(a)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/...
I consider that a design requirement for EE 7.
-Dan
On Fri, Jan 14, 2011 at 16:09, Mark Struberg <struberg(a)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(a)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