@Override
 public void run() {
   try {
     barrier1.await();
     barrier2.await();
     for (int i = 0; i < writerIterations; i++) {
       int id = idGenerator.incrementAndGet();
       String sId = Integer.toString(id);
       Document doc = doc().add(field("_id", sId)).add(field("content", content(id))).build();
       if (create) {
         engine.create(
             new Engine.Create(doc, Lucene.STANDARD_ANALYZER, "type", sId, TRANSLOG_PAYLOAD));
       } else {
         engine.index(
             new Engine.Index(
                 new Term("_id", sId),
                 doc,
                 Lucene.STANDARD_ANALYZER,
                 "type",
                 sId,
                 TRANSLOG_PAYLOAD));
       }
     }
   } catch (Exception e) {
     System.out.println("Writer thread failed");
     e.printStackTrace();
   } finally {
     latch.countDown();
   }
 }
 @Override
 public void run() {
   try {
     barrier1.await();
     barrier2.await();
     for (int i = 0; i < searcherIterations; i++) {
       Engine.Searcher searcher = engine.searcher();
       TopDocs topDocs =
           searcher.searcher().search(new TermQuery(new Term("content", content(i))), 10);
       // read one
       searcher.searcher().doc(topDocs.scoreDocs[0].doc, new LoadFirstFieldSelector());
       searcher.release();
     }
   } catch (Exception e) {
     System.out.println("Searcher thread failed");
     e.printStackTrace();
   } finally {
     latch.countDown();
   }
 }