On Wed, Jul 22, 2009 at 9:11 AM, Steve Roy
<steveroy@ensighttech.com>
wrote:
It would be nice if the design made it easy for resources to be
released when the beforePhase/afterPhase processing completes so
developers don't inadvertently forget to release expensive resources.
I can see the need for the feature. There is a danger though,
that it makes it too easy for developers to implement time &
resource expensive operations for invocations of the JSF lifecycle,
which should be considered time sensitive.
My focus was not necessarily on hooks to cleanup expensive resources.
To clarify, my focus is to get listeners to tie in better with the EE
platform. For instance, if I am developing an extension to JSF, and I
want to manipulate the JSR-299 conversation or perhaps wrap one or more
phases in a UserTransaction, there is no portable way to inject the
necessary components. Another use case is that I want to store state in
a JSR-299 contextual object or a stateful EJB session bean (or a hybrid
of the two). Again, no portable way to access this bean. What I am
looking for are injections like the following:
@Resource UserTransaction transaction;
@Current Conversation conversation;
@EJB Cart cart;
@Current StatusMessages statusMessages;
Right now phase and system event listeners have to use JNDI to get at
any of those resources, with subsequent calls necessary in some cases
(such as to get a contextual instance from the BeanManager).
My point is that managed objects in the Java EE platform should be able
to receive injections. I see phase listeners and system event listeners
as managed objects.
-Dan