Ejemplo n.º 1
0
 /**
  * @param args
  * @throws IOException
  * @throws InterruptedException
  */
 public static void main(String[] args)
     throws IOException, InterruptedException, BookieException, KeeperException {
   Bookie b = new Bookie(new ServerConfiguration());
   b.start();
   CounterCallback cb = new CounterCallback();
   long start = MathUtils.now();
   for (int i = 0; i < 100000; i++) {
     ByteBuffer buff = ByteBuffer.allocate(1024);
     buff.putLong(1);
     buff.putLong(i);
     buff.limit(1024);
     buff.position(0);
     cb.incCount();
     b.addEntry(buff, cb, null, new byte[0]);
   }
   cb.waitZero();
   long end = MathUtils.now();
   System.out.println("Took " + (end - start) + "ms");
 }
Ejemplo n.º 2
0
 private String getMyId() throws UnknownHostException {
   return Bookie.getBookieAddress(conf).toString();
 }