Question regarding close and commit with UserTransaction
Gurdev Parmar <[email protected]> Wed, 25 Dec 2002 11:30:21 +0530
| Newsgroups | gmane.comp.java.sun.connector |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I am running a test case with two app servers and am
seeing different behaviors.
What I am doing:
- I use a stateless session bean with bean demarcated transactions.
- I do the following in a method:
method {
UserTransaction utx = null;
Connection con1 = null;
Connection con2 = null;
try {
utx = ctx.getUserTransaction();
utx.begin();
con1 = getXAConnection1();
//do stuff using con1
con2 = getXAConnection2();
//do stuff using con2
utx.commit();
} catch (Exception e) {
utx.rollback();
//error handling
} finally {
if (con1 != null)
con1.close;
if (con2 != null)
con2.close();
}
}
In one app server there does not seem to be any problem in what I do.
In another app server there is a problem if I close the connection after
utx.commit(). It throws IllegalStateException when it reaches the
con.close()
part.
So, what is the right behavior?
Thanks ,
Gurdev
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff CONNECTOR-INTEREST". For general help, send email to
[email protected] and include in the body of the message "help".