ZooKeeperCounter { public void reset() throws KeeperException, IOException, InterruptedException { resetTo(0L); } ZooKeeperCounter(ZooKeeperService svc, String prefix);  ZooKeeperCounter(String name); void reset(); synchronized void resetTo(long value); long incrementAndGet(); long incrementAndGetBy(long incr); void shutdown();  }
@Test public void testReset() throws IOException, InterruptedException, KeeperException { ZooKeeperCounter seq = new ZooKeeperCounter(svc, "/seq-generator-reset-test"); for (long i=0; i < 1024; ++i) { seq.resetTo(i); assertEquals(i, seq.incrementAndGet()); } seq.shutdown(); }