diff --git a/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/SetPropertyTest.java b/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/SetPropertyTest.java index 438436c..c67d797 100644 --- a/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/SetPropertyTest.java +++ b/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/SetPropertyTest.java @@ -19,6 +19,7 @@ package org.apache.jackrabbit.oak.benchmark; import java.util.Map; import java.util.UUID; +import javax.jcr.InvalidItemStateException; import javax.jcr.Node; import javax.jcr.RepositoryException; import javax.jcr.Session; @@ -48,7 +49,11 @@ public class SetPropertyTest extends AbstractTest { public void beforeTest() throws RepositoryException { Thread t = Thread.currentThread(); Node node = nodes.get(t); - if (node == null) { + + // since warm up is done from the same Thread for all fixtures, we + // might end up with a stale child node from the previous fixture + // running this benchmark + if (node == null || isStale(node)) { Session s = getRepository().login(getCredentials()); node = s.getRootNode().getNode(testNodeName).addNode(UUID.randomUUID().toString()); node.setProperty("count", -1); @@ -57,6 +62,16 @@ public class SetPropertyTest extends AbstractTest { } } + private boolean isStale(Node node) throws RepositoryException { + try { + node.refresh(true); + } catch (InvalidItemStateException e) { + return true; + } + + return false; + } + @Override public void runTest() throws Exception { Node node = nodes.get(Thread.currentThread());