Forum Stats

  • 3,758,942 Users
  • 2,251,479 Discussions
  • 7,870,440 Comments

Discussions

Releasing XASession XAResource - Manual enlisting

1000868
1000868 Member Posts: 2
edited Apr 4, 2013 6:35PM in Java Message Service (JMS)
In our MDB we have a Xatransaction between DB and Tibco foreign server Queue. we have enlisted the foreign server XaResouce using below.

The MDB is on Weblogic server 10.3.6, JDK 1.6.

XASession xaSession = xaConn.createXASession();
TransactionHelper txHelper = TransactionHelper.popTransactionHelper();
Transaction tx = txHelper.getTransaction();
tx.enlistResource(xaSession.getXAResource());

Transactions are working fine.

but the problem is releasing resources. after few thousand msgs i see heap containing same number of Tibjmsxasession,Tibjmsxaresource,Tibjmslongkey objects. this leads to outofmemory issue.

we cannot use session.close() in between the transaction.

the transaction are container managed. only enlisting is done manually.

Edited by: 997865 on Apr 3, 2013 10:16 AM

Answers

  • 1000868
    1000868 Member Posts: 2
    i used

    tx.registerSynchronization(new SessionSynchronization());

    SessionSynchronization implements Synchronization and has 2 methods afterCompletion and beforeCompletion.

    session.close can be called inside afterCompletion.
This discussion has been closed.