[infinispan-commits] Infinispan SVN: r1007 - trunk/core/src/test/java/org/infinispan/profiling.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Mon Oct 26 08:18:36 EDT 2009
Author: manik.surtani at jboss.com
Date: 2009-10-26 08:18:36 -0400 (Mon, 26 Oct 2009)
New Revision: 1007
Modified:
trunk/core/src/test/java/org/infinispan/profiling/ProfileTest.java
trunk/core/src/test/java/org/infinispan/profiling/ProfileTestSlave.java
Log:
Remote profiling tweaks
Modified: trunk/core/src/test/java/org/infinispan/profiling/ProfileTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/profiling/ProfileTest.java 2009-10-26 11:43:56 UTC (rev 1006)
+++ trunk/core/src/test/java/org/infinispan/profiling/ProfileTest.java 2009-10-26 12:18:36 UTC (rev 1007)
@@ -26,7 +26,7 @@
/*
Test configuration flags
*/
- protected static final long NUM_OPERATIONS = 1000000; // DURATION is replaced with a fixed number of operations instead.
+ protected static long NUM_OPERATIONS = 1000000; // DURATION is replaced with a fixed number of operations instead.
protected static final int NUM_THREADS = 25;
protected static final int MAX_RANDOM_SLEEP_MILLIS = 1;
protected static final int MAX_OVERALL_KEYS = 2000;
@@ -41,6 +41,8 @@
pst.startedInCmdLine = true;
String mode = args[0];
+ if (args.length > 1) NUM_OPERATIONS = Integer.parseInt(args[1]);
+
try {
if (args.length > 1) pst.clusterNameOverride = args[1];
pst.testWith(mode);
@@ -76,7 +78,7 @@
doTest();
// wait for user exit
- System.in.read();
+// System.in.read();
}
/**
Modified: trunk/core/src/test/java/org/infinispan/profiling/ProfileTestSlave.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/profiling/ProfileTestSlave.java 2009-10-26 11:43:56 UTC (rev 1006)
+++ trunk/core/src/test/java/org/infinispan/profiling/ProfileTestSlave.java 2009-10-26 12:18:36 UTC (rev 1007)
@@ -1,5 +1,8 @@
package org.infinispan.profiling;
+import org.infinispan.notifications.Listener;
+import org.infinispan.notifications.cachemanagerlistener.event.ViewChangedEvent;
+import org.infinispan.notifications.cachemanagerlistener.annotation.ViewChanged;
import org.testng.annotations.Test;
@Test(groups = "profiling", enabled = false, testName = "profiling.ProfileTestSlave")
@@ -44,8 +47,11 @@
}
private void waitForTest() throws Exception {
+ // attach a view change listener
+ cacheManager.addListener(new ShutdownHook());
System.out.println("Slave listening for remote connections. Hit Enter when done.");
System.in.read();
+ System.in.read();
}
private void doTest() {
@@ -60,4 +66,15 @@
doTest();
waitForTest();
}
+
+ @Listener
+ public static final class ShutdownHook {
+ @ViewChanged
+ public void viewChanged(ViewChangedEvent vce) {
+ // if the new view ONLY contains me, die!
+ if (vce.getOldMembers().size() > vce.getNewMembers().size() && vce.getNewMembers().size() == 1 && vce.getNewMembers().contains(vce.getLocalAddress())) {
+ System.exit(0);
+ }
+ }
+ }
}
More information about the infinispan-commits
mailing list