changeset 1594:5c308934c4fc

PR2129: storage-profile seemingly never completes for http(s):// URLs Reviewed-by: omajid Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2014-December/012026.html
author Severin Gehwolf <sgehwolf@redhat.com>
date Fri, 05 Dec 2014 14:53:14 +0100
parents 0133da742cc7
children ac7dfc87dcba
files storage-profile/common/src/main/java/com/redhat/thermostat/storage/profile/internal/StorageProfileCommand.java
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/storage-profile/common/src/main/java/com/redhat/thermostat/storage/profile/internal/StorageProfileCommand.java	Thu Dec 04 14:13:40 2014 -0500
+++ b/storage-profile/common/src/main/java/com/redhat/thermostat/storage/profile/internal/StorageProfileCommand.java	Fri Dec 05 14:53:14 2014 +0100
@@ -192,6 +192,15 @@
                 statement.setLong(2, i);
                 statement.execute();
             }
+            // The way how this is used assumes that all queued items have been
+            // executed when measureAdd() returns. However this may not always
+            // be the case and thus clearAndVerifyAllData() may be called already
+            // while some insert jobs are still about to get inserted.
+            // This waitForDataCount() call essentially acts as a barrier to not
+            // proceed until all inserts have completed. Otherwise there is no
+            // way to ensure that after a remove stmt the count will reach 0.
+            // Some inserts scheduled above might insert after the remove.
+            waitForDataCount(console, ITERATIONS);
             long end = System.nanoTime();
             console.getOutput().println("ADD (x" + ITERATIONS + ") took " + nanosToMicroSeconds(end-start));
             console.getOutput().println("ADD avg was " + nanosToMicroSeconds(1.0 * (end-start) / ITERATIONS));