Author |
Message
|
Rclements |
Posted: Thu Aug 01, 2002 12:25 pm Post subject: Cleaning up of JMS resources in a distributed transaction |
|
|
Novice
Joined: 20 Jun 2002 Posts: 18
|
I am using a stateless bean which writes messages to a queue. This activity takes place in a distributed transaction..
Q. Each message is part of some transaction, so I create a new session and sender at the begining of the log method. After queueSender.send(msg) occurs, when should queueSession.close(), queueSender.close() be called. |
|
Back to top |
|
 |
amigupta1978 |
Posted: Thu Aug 01, 2002 10:22 pm Post subject: |
|
|
Centurion
Joined: 22 Jan 2002 Posts: 132 Location: India
|
hi,
is MQseries is acting as the contact admin coordinator or ur appserver is coordinating the transaction?
I think u can safely issue quesession.close() after the send call (in the same log method only) since u r creating a new instance every time ( to release the resources oustside JVM) This shud not affect ur transaction.
Regards,
Amit |
|
Back to top |
|
 |
Rclements |
Posted: Fri Aug 02, 2002 11:48 am Post subject: |
|
|
Novice
Joined: 20 Jun 2002 Posts: 18
|
The transaction is being coordinated via JTA, and someone in the calling chain is managing the UserTransaction.
Consequently, I can't issue the queuesession.close() in the same method, otherwise since the transaction has not been commited, it causes a rollback.
tried it before i posted
the only place that i can release the resources is when i go to establish a new queuesession (next time into the log method, I check to see if i have a queuesession, if i do, then i close it (the old one) and open a new one)
This works, but feels very wrong. |
|
Back to top |
|
 |
kingdon |
Posted: Mon Aug 05, 2002 9:54 am Post subject: |
|
|
Acolyte
Joined: 14 Jan 2002 Posts: 63 Location: UK
|
Sounds wrong to me too. What sort of connection factory are you using? It should be a WebSphere specific one (a WSQCF), not the generic QCF, the connections of which will have no knowledge of any XA transactions. Closing an XA aware session/connection should have no effect on the transactional state.
Regards,
James. |
|
Back to top |
|
 |
Rclements |
Posted: Tue Aug 06, 2002 3:45 am Post subject: |
|
|
Novice
Joined: 20 Jun 2002 Posts: 18
|
I am using a wsqcf in the JMSAdmin declaration.
Also, if I issue the queueSession close anywhere during the log method, the distributed transaction is rolled back (tried it). |
|
Back to top |
|
 |
kingdon |
Posted: Tue Aug 06, 2002 7:20 am Post subject: |
|
|
Acolyte
Joined: 14 Jan 2002 Posts: 63 Location: UK
|
My understanding is that it shouldn't be doing that. It would be worth just double checking that the code is using the connection factory you think it is, and if that doesn't turn up anything I'd suggest making a call to IBM support. They should be able to help diagnose the problem and work out where things have gone astray.
Regards,
James. |
|
Back to top |
|
 |
|