Author: bstansberry(a)jboss.com
Date: 2008-04-08 22:38:58 -0400 (Tue, 08 Apr 2008)
New Revision: 5521
Modified:
core/branches/2.1.X/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
Log:
[JBCACHE-1326] Don't leak MethodCall to thread
Modified:
core/branches/2.1.X/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
---
core/branches/2.1.X/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-04-09
01:08:38 UTC (rev 5520)
+++
core/branches/2.1.X/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-04-09
02:38:58 UTC (rev 5521)
@@ -836,7 +836,7 @@
* @return
* @throws Throwable
*/
- private Object handleCommitRollback(InvocationContext ctx) throws Throwable
+ private Object handleCommitRollback(InvocationContext ctx, MethodCall call) throws
Throwable
{
//GlobalTransaction gtx = findGlobalTransaction(m.getArgs());
GlobalTransaction gtx = ctx.getGlobalTransaction();
@@ -850,7 +850,16 @@
//if (!ltx.equals(currentTx)) throw new IllegalStateException(" local
transaction " + ltx + " transaction does not match running tx " +
currentTx);
- result = nextInterceptor(ctx);
+ MethodCall originalCall = ctx.getMethodCall();
+ ctx.setMethodCall(call);
+ try
+ {
+ result = nextInterceptor(ctx);
+ }
+ finally
+ {
+ ctx.setMethodCall(originalCall);
+ }
if (log.isDebugEnabled()) log.debug("Finished local commit/rollback method for
" + gtx);
return result;
@@ -897,8 +906,8 @@
{
log.trace(" running commit for " + gtx);
}
- ctx.setMethodCall(commitMethod);
- handleCommitRollback(ctx);
+
+ handleCommitRollback(ctx, commitMethod);
}
catch (Throwable e)
{
@@ -958,8 +967,7 @@
//ltx = getLocalTxForGlobalTx(gtx);
rollbackTransactions.put(tx, gtx);
- ctx.setMethodCall(rollbackMethod);
- handleCommitRollback(ctx);
+ handleCommitRollback(ctx, rollbackMethod);
}
catch (Throwable e)
{
@@ -1014,8 +1022,16 @@
//if ltx is not null and it is already running
if (txManager.getTransaction() != null && ltx != null &&
txManager.getTransaction().equals(ltx))
{
+ MethodCall originalCall = ctx.getMethodCall();
ctx.setMethodCall(prepareMethod);
- result = nextInterceptor(ctx);
+ try
+ {
+ result = nextInterceptor(ctx);
+ }
+ finally
+ {
+ ctx.setMethodCall(originalCall);
+ }
}
else
{
Show replies by date