[jbosscache-commits] JBoss Cache SVN: r6350 - benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Jul 21 15:23:00 EDT 2008


Author: mircea.markus
Date: 2008-07-21 15:23:00 -0400 (Mon, 21 Jul 2008)
New Revision: 6350

Modified:
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java
Log:
added new barrier


Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java	2008-07-21 13:04:46 UTC (rev 6349)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java	2008-07-21 19:23:00 UTC (rev 6350)
@@ -37,10 +37,12 @@
    public StatisticTestResult doTest(String testName, CacheWrapper cache, String testCaseName, int sampleSize, int numThreads) throws Exception
    {
       log.trace("TestCase = '" + testCaseName + "', TestName = " + testName);
-      barrierBeforeReplicationTest();
+      barrier("BEFORE_REPLICATION_OCCURS_BARRIER");
 
       Integer currentNodeIndex = conf.getClusterConfig().getCurrentNodeIndex();
       tryToPut(cache, currentNodeIndex);
+
+      barrier("AFTER_ADDING_LOCAL_ELEMENTS_BARRIER");      
       Thread.sleep(REPLICATION_TRY_SLEEP);//just to make sure that prev barrier closed its sockets etc
 
       if (conf.getClusterConfig().getClusterSize() == 1)
@@ -82,6 +84,7 @@
             tryCount++;
          }
       }
+      throw new Exception("Couldn't accomplish additiona before replication!");
    }
 
    /**
@@ -114,13 +117,12 @@
       return receivedValues;
    }
 
-   private void barrierBeforeReplicationTest()
-         throws Exception
+   private void barrier(String res) throws Exception
    {
       ClusterBarrier barrier = new ClusterBarrier();
       barrier.setAcknowledge(true);
       barrier.setConfig(conf.getClusterConfig());
-      barrier.barrier("BEFORE_REPLICATION_OCCURS_BARRIER");
+      barrier.barrier(res);
    }
 
    private StatisticTestResult allReplicatedFine(Map<SocketAddress, Object> receivedValues)
@@ -216,7 +218,7 @@
       //this means SOME replication occurred. This does not mean, though, that all nodes replicated successfuly.
       //correct condition would be >= this.conf.getClusterConfig().getClusterSize()
       //todo/FIXME - this seem not to work with all the products, so we will accept 'some replication'
-      if (totalValue < this.conf.getClusterConfig().getClusterSize())
+      if (totalValue < this.conf.getClusterConfig().getClusterSize() && totalValue != 0)
       {
          log.warn("The replication was not total, but partial!!");
       }




More information about the jbosscache-commits mailing list