add sleep before close to stress test

This commit is contained in:
kimchy 2010-05-18 21:11:44 +03:00
parent 10bc248000
commit 44769b7c04
1 changed files with 12 additions and 1 deletions

View File

@ -64,6 +64,7 @@ public class NodesStressTest {
private Indexer[] indexThreads = new Indexer[1];
private TimeValue sleepAfterDone = TimeValue.timeValueMillis(0);
private TimeValue sleepBeforeClose = TimeValue.timeValueMillis(0);
private CountDownLatch latch;
private CyclicBarrier barrier1;
@ -107,6 +108,11 @@ public class NodesStressTest {
return this;
}
public NodesStressTest sleepBeforeClose(TimeValue time) {
this.sleepBeforeClose = time;
return this;
}
public NodesStressTest build(Settings settings) throws Exception {
settings = settingsBuilder()
// .put("index.engine.robin.refreshInterval", 1, TimeUnit.SECONDS)
@ -166,6 +172,10 @@ public class NodesStressTest {
latch.await();
stopWatch.stop();
System.out.println("Done, took [" + stopWatch.totalTime() + "]");
System.out.println("Sleeping before close: " + sleepBeforeClose);
Thread.sleep(sleepBeforeClose.millis());
for (Client client : clients) {
client.close();
}
@ -173,7 +183,7 @@ public class NodesStressTest {
node.close();
}
System.out.println("Done, took [" + stopWatch.totalTime() + "]");
System.out.println("Sleeping before exit: " + sleepBeforeClose);
Thread.sleep(sleepAfterDone.millis());
}
@ -260,6 +270,7 @@ public class NodesStressTest {
.indexIterations(10 * 1000)
.searcherThreads(5)
.searchIterations(10 * 1000)
.sleepBeforeClose(TimeValue.timeValueMinutes(10))
.sleepAfterDone(TimeValue.timeValueMinutes(10))
.build(EMPTY_SETTINGS);