/**
  * Code for each 'client' to run.
  *
  * @param id
  * @param c
  * @param sharedConnection
  * @throws IOException
  */
 static void cycle(int id, final Configuration c, final HConnection sharedConnection)
     throws IOException {
   HTableInterface table = sharedConnection.getTable(BIG_USER_TABLE);
   table.setAutoFlushTo(false);
   long namespaceSpan = c.getLong("hbase.test.namespace.span", 1000000);
   long startTime = System.currentTimeMillis();
   final int printInterval = 100000;
   Random rd = new Random(id);
   boolean get = c.getBoolean("hbase.test.do.gets", false);
   try {
     Stopwatch stopWatch = new Stopwatch();
     stopWatch.start();
     for (int i = 0; i < namespaceSpan; i++) {
       byte[] b = format(rd.nextLong());
       if (get) {
         Get g = new Get(b);
         table.get(g);
       } else {
         Put p = new Put(b);
         p.add(HConstants.CATALOG_FAMILY, b, b);
         table.put(p);
       }
       if (i % printInterval == 0) {
         LOG.info("Put " + printInterval + "/" + stopWatch.elapsedMillis());
         stopWatch.reset();
         stopWatch.start();
       }
     }
     LOG.info(
         "Finished a cycle putting "
             + namespaceSpan
             + " in "
             + (System.currentTimeMillis() - startTime)
             + "ms");
   } finally {
     table.close();
   }
 }