On Oct 23, 2012 11:42 AM, "Nigel Deakin" <nigel.deakin_at_oracle.com> wrote:
>
> [Pete]
>
>>>>>> 2) Some feedback for the CDI community comes from the way that JMS
wants a "gracefully degrading scope" such
>>>>>> that @TransactionScoped is used if a transaction is in progress,
otherwise a request scoped is used. I would hope
>>>>>> to specify this idea in CDI 2.0, hopefully in a way that JMS can
then use (as opposed to specifying it directly)
>
>
> [Nigel]
>
>>>>> Would this expand the definition of @TransactionScoped to state that
it degrades to to be the same as
>>>>> @RequestScoped when there was no transaction?
>>>>>
>>>>> How would this relate to whatever the JTA spec lead is planning to
say about @TransactionScoped? Should that spec
>>>>> (rather than CDI) define @TransactionScoped as a gracefully degrading
scope?
>
>
> [Pete]
>
>>>> More that you could define a bean to be @TransactionScoped and that
*this bean* degrades to @RequestScoped if the
>>>> transaction is not active.
>
>
> [Nigel]
>
>>> How does that differ from what is currently proposed? Or are you
suggesting that the "degrading option" is specified on the bean somehow?
>
>
> [Pete]
>
>> Yes, for example @TransactionScoped
@RequestScoped(ifNotActive=TransactionScoped.class)
>> or something like that (note this is just an idea right now!)
>
>
> Right, I see. That would simplify the implementation of JMSContexts but
not affect applications.
>
> In addition, once such a feature was added we could change the JMS spec
to define the scope of JMSContexts in terms of this feature (i.e. it would
explicitly state that the scope of an injected JMSContext would be
> @TransactionScoped @RequestScoped(ifNotActive=TransactionScoped.class)
>
> I appreciate this is just an idea right now. But looks like JMS could
adopt it easily enough when the time came.
I've mentioned this to Nigel, but ftr we would look at this for cdi 2. More
details on that soon!