-
Bug
-
Resolution: Done
-
Major
-
8.1.0.Final
-
None
From this email thread.
Note that if you @Inject JMSProducer into a @ApplicationScoped bean then that's the scoping used, although it's not correct as the scope should be either @Request or @TransactionScoped
To: users@jms-spec.java.net
Subject: [jms-spec users] Re: Confusion about JMSProducer methods and CDI
On 05/06/2014 19:29, Elias Ross wrote:
>
> The other question I had was the scoping for CDI. For example:
>
> @ApplicationScoped
> public class MyClient
>
> public class MyServlet extends HttpServlet
>
> Then JMSContext ends up being potentially shared between multiple
> threads. I would expect the scoping of JMSContext to be request, not
> @Dependent here.
>
Why do you say that the "JMSContext ends up being potentially shared between multiple threads"?
The scope of the injected JMSContext is defined in the JMS 2.0 spec, section 12.4.4. "Scope of injected JMSContext
objects". Essentially, if there's a transaction in progress then the injected JMSContext will have transaction scope,
otherwise it will have request scope.
It looks like you're in a servlet here, and you haven't started a transaction, so the injected JMSContext must have
request scope.
The scope of the injected JMSContext is defined in the JMS 2.0 spec, section 12.4.4. "Scope of injected JMSContext objects". Essentially, if there's a transaction in progress then the injected JMSContext will have transaction scope, otherwise it will have request scope.
It looks like you're in a servlet here, and you haven't started a transaction, so the injected JMSContext must have request scope.
- causes
-
JBEAP-4567 Unable to get managed connection exception with injected JMSContext
- Verified