JBoss Cache SVN: r8498 - core/branches/3.2.2.GA_JBCACHE-1613/src/main/java/org/jboss/cache/interceptors.
by jbosscache-commits@lists.jboss.org
Author: dereed
Date: 2012-06-06 16:36:33 -0400 (Wed, 06 Jun 2012)
New Revision: 8498
Modified:
core/branches/3.2.2.GA_JBCACHE-1613/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
Log:
[JBPAPP-9264] Backport JBCACHE-1613
Modified: core/branches/3.2.2.GA_JBCACHE-1613/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/branches/3.2.2.GA_JBCACHE-1613/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2012-06-06 20:27:01 UTC (rev 8497)
+++ core/branches/3.2.2.GA_JBCACHE-1613/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2012-06-06 20:36:33 UTC (rev 8498)
@@ -896,6 +896,13 @@
public void beforeCompletion()
{
+ beforeCompletion(true);
+ }
+
+ // resetInvocationContext=false should be used by sub classes that call
+ // invocationContextContainer.remove themselves
+ protected void beforeCompletion(boolean resetInvocationContext)
+ {
if (trace) log.trace("Running beforeCompletion on gtx " + gtx);
if (transactionContext == null)
@@ -916,6 +923,11 @@
assertCanContinue();
ctx.setOriginLocal(false);
+
+ // JBCACHE-1613: remove the ThreadLocal reference to ctx, in case a different
+ // thread calls afterCompletion
+ if(resetInvocationContext)
+ invocationContextContainer.remove();
}
// this should really not be done here -
@@ -935,6 +947,10 @@
}
}
+ // JBCACHE-1613: Make sure our ThreadLocal is set to ctx, in case beforeCompletion
+ // was called with a different thread
+ invocationContextContainer.set(ctx);
+
try
{
assertCanContinue();
@@ -1068,7 +1084,7 @@
@Override
public void beforeCompletion()
{
- super.beforeCompletion();
+ super.beforeCompletion(false);
ctx.setOriginLocal(!remoteLocal); // this is the LOCAL sync handler after all!
// fetch the modifications before the transaction is committed
// (and thus removed from the txTable)
@@ -1140,6 +1156,10 @@
localRollbackOnly = false;
setTransactionalContext(null, null, null, ctx);
ctx.setOptionOverrides(originalOptions);
+
+ // JBCACHE-1613: remove the ThreadLocal reference to ctx, in case a different
+ // thread calls afterCompletion
+ invocationContextContainer.remove();
}
}
12 years, 6 months
JBoss Cache SVN: r8497 - core/branches.
by jbosscache-commits@lists.jboss.org
Author: dereed
Date: 2012-06-06 16:27:01 -0400 (Wed, 06 Jun 2012)
New Revision: 8497
Added:
core/branches/3.2.2.GA_JBCACHE-1613/
Log:
[JBPAPP-9264] Backport JBCACHE-1613 to JBoss Cache 3.2.2
12 years, 6 months
JBoss Cache SVN: r8496 - core/trunk/src/main/java/org/jboss/cache/interceptors.
by jbosscache-commits@lists.jboss.org
Author: dereed
Date: 2012-06-05 19:57:33 -0400 (Tue, 05 Jun 2012)
New Revision: 8496
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
Log:
[JBCACHE-1613] Fix data corruption between threads when using JTS transaction manager
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2012-06-05 23:45:24 UTC (rev 8495)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2012-06-05 23:57:33 UTC (rev 8496)
@@ -896,6 +896,13 @@
public void beforeCompletion()
{
+ beforeCompletion(true);
+ }
+
+ // resetInvocationContext=false should be used by sub classes that call
+ // invocationContextContainer.remove themselves
+ protected void beforeCompletion(boolean resetInvocationContext)
+ {
if (trace) log.trace("Running beforeCompletion on gtx " + gtx);
if (transactionContext == null)
@@ -916,6 +923,11 @@
assertCanContinue();
ctx.setOriginLocal(false);
+
+ // JBCACHE-1613: remove the ThreadLocal reference to ctx, in case a different
+ // thread calls afterCompletion
+ if(resetInvocationContext)
+ invocationContextContainer.remove();
}
// this should really not be done here -
@@ -935,6 +947,10 @@
}
}
+ // JBCACHE-1613: Make sure our ThreadLocal is set to ctx, in case beforeCompletion
+ // was called with a different thread
+ invocationContextContainer.set(ctx);
+
try
{
assertCanContinue();
@@ -1068,7 +1084,7 @@
@Override
public void beforeCompletion()
{
- super.beforeCompletion();
+ super.beforeCompletion(false);
ctx.setOriginLocal(!remoteLocal); // this is the LOCAL sync handler after all!
// fetch the modifications before the transaction is committed
// (and thus removed from the txTable)
@@ -1140,6 +1156,10 @@
localRollbackOnly = false;
setTransactionalContext(null, null, null, ctx);
ctx.setOptionOverrides(originalOptions);
+
+ // JBCACHE-1613: remove the ThreadLocal reference to ctx, in case a different
+ // thread calls afterCompletion
+ invocationContextContainer.remove();
}
}
12 years, 7 months
JBoss Cache SVN: r8495 - core/trunk/src/test/java/org/jboss/cache/loader/testloaders.
by jbosscache-commits@lists.jboss.org
Author: dereed
Date: 2012-06-05 19:45:24 -0400 (Tue, 05 Jun 2012)
New Revision: 8495
Modified:
core/trunk/src/test/java/org/jboss/cache/loader/testloaders/DummyInMemoryCacheLoader.java
Log:
[JBCACHE-1615] Improve performance of DummyInMemoryCacheLoader#remove for large caches
Modified: core/trunk/src/test/java/org/jboss/cache/loader/testloaders/DummyInMemoryCacheLoader.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/testloaders/DummyInMemoryCacheLoader.java 2012-05-25 20:10:11 UTC (rev 8494)
+++ core/trunk/src/test/java/org/jboss/cache/loader/testloaders/DummyInMemoryCacheLoader.java 2012-06-05 23:45:24 UTC (rev 8495)
@@ -217,19 +217,16 @@
debugMessage("Removing fqn " + fqn);
getNodesMap().remove(fqn);
// remove children.
- recursivelyRemoveChildren(fqn);
+ removeChildren(fqn);
}
- private void recursivelyRemoveChildren(Fqn removedParent)
+ private void removeChildren(Fqn removedParent)
{
for (Fqn f : getNodesMap().keySet())
{
- if (f.getParent().equals(removedParent))
+ if (f.isChildOf(removedParent))
{
- // remove the child node too
getNodesMap().remove(f);
- // and it's children. Depth first.
- recursivelyRemoveChildren(f);
}
}
}
12 years, 7 months