private void runHammer(int threadCount, int childCount) { try { HammerThread[] threads = new HammerThread[threadCount]; long start = TimeHelper.ElapsedMiliseconds; for (int i = 0; i < threads.Length; i++) { ZooKeeper zk = createClient(); string prefix = "/test-" + i; zk.create(prefix, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); prefix += "/"; HammerThread thread = new BasicHammerThread("BasicHammerThread-" + i, zk, prefix, childCount); thread.start(); threads[i] = thread; } verifyHammer(start, threads, childCount); } catch (Exception t) { LOG.error("test Assert.failed", t); throw; } }
public void testHammerSuper() { try { const int threadCount = 5; const int childCount = 10; HammerThread[] threads = new HammerThread[threadCount]; long start = TimeHelper.ElapsedMiliseconds; for (int i = 0; i < threads.Length; i++) { string prefix = "/test-" + i; { ZooKeeper zk = createClient(); try { zk.create(prefix, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } finally { zk.close(); } } prefix += "/"; HammerThread thread = new SuperHammerThread("SuperHammerThread-" + i, this, prefix, childCount); thread.start(); threads[i] = thread; } verifyHammer(start, threads, childCount); } catch (Exception t) { LOG.error("test Assert.failed", t); throw; } }