[jboss-cvs] JBossAS SVN: r80139 - branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/tm/usertx/client.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 28 07:42:24 EDT 2008
Author: galder.zamarreno at jboss.com
Date: 2008-10-28 07:42:24 -0400 (Tue, 28 Oct 2008)
New Revision: 80139
Modified:
branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/tm/usertx/client/ClientUserTransaction.java
Log:
[JBPAPP-1285] Tpc is now properly cleared both with successfull and exceptional commit/rollback calls. Added some TRACE to help debugging in future.
Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/tm/usertx/client/ClientUserTransaction.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/tm/usertx/client/ClientUserTransaction.java 2008-10-28 11:29:41 UTC (rev 80138)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/tm/usertx/client/ClientUserTransaction.java 2008-10-28 11:42:24 UTC (rev 80139)
@@ -42,6 +42,7 @@
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
+import org.jboss.remoting.CannotConnectException;
import org.jboss.tm.TransactionPropagationContextFactory;
import org.jboss.tm.usertx.interfaces.UserTransactionSession;
@@ -113,7 +114,13 @@
throws NotSupportedException, SystemException
{
ThreadInfo info = getThreadInfo();
-
+ trace = log.isTraceEnabled(); // Only check for trace enabled once per transaction
+
+ if (trace)
+ {
+ log.trace("Calling UserTransaction.begin()");
+ }
+
try
{
Object tpc = getSession().begin(info.getTimeout());
@@ -146,15 +153,19 @@
SystemException
{
ThreadInfo info = getThreadInfo();
+ Object tpc = info.getTpc();
+ if (trace)
+ {
+ log.trace("Calling UserTransaction.commit(" + tpc + ")");
+ }
+
try
{
- getSession().commit(info.getTpc());
- info.pop();
+ getSession().commit(tpc);
}
catch (RollbackException e)
{
- info.pop();
throw e;
}
catch (HeuristicMixedException e)
@@ -184,11 +195,22 @@
logCauseException(e);
throw new SystemException(e.toString());
}
+ catch(CannotConnectException e)
+ {
+ // destroy session gone bad.
+ destroySession();
+ logCauseException(e);
+ throw new SystemException(e.toString());
+ }
catch (Exception e)
{
logCauseException(e);
throw new SystemException(e.toString());
}
+ finally
+ {
+ info.pop();
+ }
}
public void rollback()
@@ -197,11 +219,16 @@
SystemException
{
ThreadInfo info = getThreadInfo();
+ Object tpc = info.getTpc();
+ if (trace)
+ {
+ log.trace("Calling UserTransaction.rollback(" + tpc + ")");
+ }
+
try
{
- getSession().rollback(info.getTpc());
- info.pop();
+ getSession().rollback(tpc);
}
catch (SecurityException e)
{
@@ -222,11 +249,22 @@
logCauseException(e);
throw new SystemException(e.toString());
}
+ catch(CannotConnectException e)
+ {
+ // destroy session gone bad.
+ destroySession();
+ logCauseException(e);
+ throw new SystemException(e.toString());
+ }
catch (Exception e)
{
logCauseException(e);
throw new SystemException(e.toString());
}
+ finally
+ {
+ info.pop();
+ }
}
public void setRollbackOnly()
@@ -234,10 +272,16 @@
SystemException
{
ThreadInfo info = getThreadInfo();
+ Object tpc = info.getTpc();
+ if (trace)
+ {
+ log.trace("Calling UserTransaction.setRollbackOnly(" + tpc + ")");
+ }
+
try
{
- getSession().setRollbackOnly(info.getTpc());
+ getSession().setRollbackOnly(tpc);
}
catch (SystemException e)
{
@@ -267,6 +311,11 @@
ThreadInfo info = getThreadInfo();
Object tpc = info.getTpc();
+ if (log.isTraceEnabled())
+ {
+ log.trace("Calling UserTransaction.getStatus(" + tpc + ")");
+ }
+
if (tpc == null)
{
return Status.STATUS_NO_TRANSACTION;
@@ -493,7 +542,6 @@
void push(Object tpc)
{
tpcStack.addLast(tpc);
- trace = log.isTraceEnabled(); // Only check for trace enabled once per transaction
if (trace)
{
log.trace("Tpc stack: added " + this + " tpc=" + tpc);
More information about the jboss-cvs-commits
mailing list