[jbosscache-commits] JBoss Cache SVN: r7801 - core/trunk/src/test/java/org/jboss/cache/statetransfer.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Fri Feb 27 05:26:02 EST 2009
Author: manik.surtani at jboss.com
Date: 2009-02-27 05:26:02 -0500 (Fri, 27 Feb 2009)
New Revision: 7801
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java
Log:
Writer thread clears data periodically to prevent OOMs
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java 2009-02-27 10:06:26 UTC (rev 7800)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java 2009-02-27 10:26:02 UTC (rev 7801)
@@ -102,11 +102,19 @@
{
try
{
- if (tx)
- cache.getConfiguration().getRuntimeConfig().getTransactionManager().begin();
- cache.put("/test" + c, "test", c++);
- if (tx)
- cache.getConfiguration().getRuntimeConfig().getTransactionManager().commit();
+ if (c % 1000 == 0)
+ {
+ startTxIfNeeded();
+ for (int i=0; i<1000; i++) cache.removeNode("/test" + i);
+ commitTxIfNeeded();
+ c = 0;
+ }
+ else
+ {
+ startTxIfNeeded();
+ cache.put("/test" + c, "test", c++);
+ commitTxIfNeeded();
+ }
}
catch (Exception e)
{
@@ -117,6 +125,16 @@
result = c;
}
+ private void startTxIfNeeded() throws Exception
+ {
+ if (tx) cache.getConfiguration().getRuntimeConfig().getTransactionManager().begin();
+ }
+
+ private void commitTxIfNeeded() throws Exception
+ {
+ if (tx) cache.getConfiguration().getRuntimeConfig().getTransactionManager().commit();
+ }
+
public void stop()
{
stop = true;
More information about the jbosscache-commits
mailing list