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)<div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div><a href="https://github.com/seam/servlet/blob/master/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridgeServlet.java">https://github.com/seam/servlet/blob/master/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridgeServlet.java</a></div>
<div><br></div><div>I consider that a design requirement for EE 7.<br><div><br></div><div>-Dan<br><br><div class="gmail_quote">On Fri, Jan 14, 2011 at 16:09, Mark Struberg <span dir="ltr"><<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi!<br>
<br>
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.<br>
<br>
The AfterDeploymentValidation system event is defined as:<br>
<br>
"The container must fire a third event after it has validated that there are no deployment problems and before creating contexts or processing requests."<br>
<br>
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?<br>
<br>
If so, do we like to introduce a new AfterServerStart event?<br>
<br>
LieGrue,<br>
strub<br>
<br>
<br>
<br>
_______________________________________________<br>
weld-dev mailing list<br>
<a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div>Dan Allen</div>Principal Software Engineer, Red Hat | Author of Seam in Action<br>Registered Linux User #231597<br><br><a href="http://mojavelinux.com" target="_blank">http://mojavelinux.com</a><br>
<a href="http://mojavelinux.com/seaminaction" target="_blank">http://mojavelinux.com/seaminaction</a><br><a href="http://www.google.com/profiles/dan.j.allen" target="_blank">http://www.google.com/profiles/dan.j.allen</a><br>
</div></div>