Package java.util.concurrent

Examples of java.util.concurrent.ExecutorService.awaitTermination()


        }
        isRunning.set(false);
        executorService.shutdown();

        try {
            executorService.awaitTermination(30, TimeUnit.SECONDS);
        }
        catch (InterruptedException e) {
        }
        Assert.assertEquals(0, errors.get());
        Assert.assertEquals(max, componentsAdded.get());
View Full Code Here


          }
        });
      }
    } finally {
      exec.shutdown();
      while (!exec.awaitTermination(1000L, TimeUnit.MILLISECONDS));
    }
   
    // clear strong refs
    for (int j = 0; j < keyCount; j++) {
      keys.set(j, null);
View Full Code Here

    searcher = new IndexSearcher(multireader, es);
    if (VERBOSE)
      System.out.println("rewritten form: " + searcher.rewrite(query));
    assertEquals(0, searcher.search(query, 10).totalHits);
    es.shutdown();
    es.awaitTermination(1, TimeUnit.SECONDS);

    multireader.close();
    reader1.close();
    reader2.close();
    dir1.close();
View Full Code Here

    assertNull("" + exc[0], exc[0]);
    writer.close();
    dir.close();
    if (es != null) {
      es.shutdown();
      es.awaitTermination(1, TimeUnit.SECONDS);
    }
  }
 
  public void testCloseTwice() throws Exception {
    // test that we can close SM twice (per Closeable's contract).
View Full Code Here

    // Cannot shutdown until after writer is closed because
    // writer has merged segment warmer that uses IS to run
    // searches, and that IS may be using this es!
    if (es != null) {
      es.shutdown();
      es.awaitTermination(1, TimeUnit.SECONDS);
    }

    _TestUtil.checkIndex(dir);
    dir.close();
    _TestUtil.rmDir(tempDir);
View Full Code Here

            }
          }
        });
      }
      e.shutdown();
      e.awaitTermination(10, TimeUnit.SECONDS);
      imm.delete(10000);
      double mutationsPerSecond = sum(counts) / ((System.currentTimeMillis() - now) / 1000.);
      timings.add(mutationsPerSecond);
      log.info(String.format("%.1f mutations per second with %d threads", mutationsPerSecond, threads));
    }
View Full Code Here

    }
   
    threadPool.shutdown();
    while (!threadPool.isTerminated())
      try {
        threadPool.awaitTermination(1, TimeUnit.HOURS);
      } catch (InterruptedException e) {
        throw new RuntimeException(e);
      }
  }
}
View Full Code Here

    }
   
    deleteThreadPool.shutdown();
   
    try {
      while (!deleteThreadPool.awaitTermination(1000, TimeUnit.MILLISECONDS)) {}
    } catch (InterruptedException e1) {
      log.error(e1, e1);
    }
   
    if (writer != null) {
View Full Code Here

        threadPool.submit(new TraceRunnable(new LoggingRunnable(log, getAssignments)));
      }
      threadPool.shutdown();
      while (!threadPool.isTerminated()) {
        try {
          threadPool.awaitTermination(60, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
          throw new RuntimeException(e);
        }
      }
      timer.stop(Timers.EXAMINE_MAP_FILES);
View Full Code Here

   
    threadPool.shutdown();
   
    while (!threadPool.isTerminated()) {
      try {
        threadPool.awaitTermination(60, TimeUnit.SECONDS);
      } catch (InterruptedException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
      }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.