[GLASSFISH-20349] Unable to create JMS transacted session in ExecutorService threads Created: 19/Apr/13  Updated: 19/Apr/13  Resolved: 19/Apr/13

Status: Resolved
Project: glassfish
Component/s: ejb_container
Affects Version/s: 3.1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: novaks Assignee: marina vatkina
Resolution: Invalid Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

GF 3.1.2.2, Windows, single server environment (not clustered)



 Description   

There is a SLSB which makes use of ExecutorService to run an arbitrary number of threads.
Each thread connects to JMS and acts as message consumer.

In the SLBS:

<code>
ExecutorService executors = Executors.newCachedThreadPool();
executors.submit(daemon); // daemon is an instance of Runnable
</code>

Inside the Runnable's run method, we attempt to create a JMS transacted session:

<code>
this.connection = this.connectionFactory.createConnection();
this.connection.start();
this.session = this.connection.createSession(true, Session.SESSION_TRANSACTED);
this.messageConsumer = this.session.createConsumer(this.queue);
</code>

The problem is when the code above is executed, a non-transacted JMS session is created and acknowledgement mode is DUPS_OK_ACKNOWLEDGE.

The SLSB which actually creates the threads by calling ExecutorService uses container manager transaction, transaction attribute is set to REQUIRED but these settings do not seem to have any effect.

Thanks for your feedback.



 Comments   
Comment by novaks [ 19/Apr/13 ]

Just a small addition, Transaction Support on the connection factory is set to "XATransaction".

Comment by marina vatkina [ 19/Apr/13 ]

It is not permitted to manage threads from an EJB. With GlassFish 4.0 you can use JSR 236 API to do so correctly.

Generated at Tue Jul 07 03:14:46 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.