[cdi-dev] Application lifecycle events

Lincoln Baxter lbaxter at redhat.com
Tue Sep 6 10:33:59 EDT 2011


		• @Initialized @Application Object o;
		• @Destroyed @Application Object o;

WebApp - ServletContextInitialized /Destroyed (or just ServletContext)
Non WebApp - Are you thinking Java SE? If so, not sure you really need anything in the object except the command line arguments.

		• @Initialized @Session Object o;
		• @Destroyed @Session Object o;

WebApp - SessionInitialized /Destroyed(or just Session)
Non WebApp - this seems like a pretty Web-oriented concept. Not sure it has a place in non Web.

		• @Initialized @Conversation Object o;
		• @Destroyed @Conversation Object o;

WebApp - ConversationInitialized /Destroyed(or just Conversation)
Non WebApp - this seems like a pretty Web-oriented concept. Not sure it has a place in non Web.


		• @Initialized @Request Object o;
		• @Destroyed @Request Object o;

WebApp - RequestInitialized /Destroyed( This one cannot be just the Request because you also need access to the Response.)
Non WebApp - this seems like a pretty Web-oriented concept. Not sure it has a place in non Web.

Not sure about JMS and Remote EJB initializations. Are these events exposed via another programmatic API currently? If so, what objects do they use?

javax.enterprise.context.lifecycle seems reasonable to me.


--
Lincoln Baxter, III
JBoss, by Red Hat
lbaxter at redhat.com

"If you want something, you'll find a way; if you don't, you'll find an excuse."

----- Original Message -----
From: "Pete Muir" <pmuir at bleepbleep.org.uk>
To: "CDI-Dev" <cdi-dev at lists.jboss.org>
Sent: Tuesday, September 6, 2011 8:05:58 AM
Subject: [cdi-dev] Application lifecycle events

I've created a pull request for https://issues.jboss.org/browse/CDI-86 at https://github.com/jboss/cdi/pull/39.

This adds these events:

		• @Initialized @Application Object o;
		• @Destroyed @Application Object o;
		• @Initialized @Session Object o;
		• @Destroyed @Session Object o;
		• @Initialized @Conversation Object o;
		• @Destroyed @Conversation Object o;
		• @Initialized @Request Object o;
		• @Destroyed @Request Object o;

The actual event type depends on why the context was initialized (e.g. if it's a web app you would normally see the relevant servlet event objects). More details in the pull

There are a few open issues on which I appreciate feedback:

* The CDI 1.0 spec doesn't define when a context is "initialized" (however the concept is implied), however the CDI spec introduces lifecycle events that require an event to be fired when a context is initialized. Either we need to rewrite the definition of this feature to use the CDI 1.0 language or we need to define when a context is initialized.
* What should the event type be for requests initialized due to an EJB remote invocation and a JMS MessageListener invocation?
* What should the event type be for applications initialized or destroyed when the application is not a web app?
* The annotations for context lifecycle events are in the new package javax.enterprise.context.lifecycle. Should they be placed elsewhere (especially if we envision them being used for other purposes than context lifecycle events?)
_______________________________________________
cdi-dev mailing list
cdi-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev



More information about the cdi-dev mailing list