Examples of awaitTermination()


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

    sort.setSort (new SortField ("int", SortField.INT),
                                new SortField ("string", SortField.STRING),
        new SortField ("float", SortField.FLOAT, true) );
    assertMatches (parallelSearcher, queryG, sort, "ZYXW");
    parallelSearcher.close();
    exec.awaitTermination(1000, TimeUnit.MILLISECONDS);
  }

  // test sorts using a series of fields
  public void testSortCombos() throws Exception {
    sort.setSort (new SortField ("int", SortField.INT), new SortField ("float", SortField.FLOAT) );
View Full Code Here

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

  public void testParallelMultiSort() throws Exception {
    ExecutorService exec = Executors.newFixedThreadPool(_TestUtil.nextInt(random, 2, 8));
    Searcher searcher = new ParallelMultiSearcher (exec, searchX, searchY);
    runMultiSorts(searcher, false);
    searcher.close();
    exec.awaitTermination(1000, TimeUnit.MILLISECONDS);
  }

  // test that the relevancy scores are the same even if
  // hits are sorted
  public void testNormalizedScores() throws Exception {
View Full Code Here

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

    }
   
    spellChecker.close();
    executor.shutdown();
    // wait for 60 seconds - usually this is very fast but coverage runs could take quite long
    executor.awaitTermination(60L, TimeUnit.SECONDS);
   
    for (int i = 0; i < workers.length; i++) {
      assertFalse(String.format("worker thread %d failed", i), workers[i].failed);
      assertTrue(String.format("worker thread %d is still running but should be terminated", i), workers[i].terminated);
    }
View Full Code Here

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

        // commit log recovery just sends work to the mutation stage. (there could have already been work there anyway. 
        // Either way, we need to let this one drain naturally, and then we're finished.
        setMode("Draining: clearing mutation stage", false);
        mutationStage.shutdown();
        while (!mutationStage.isTerminated())
            mutationStage.awaitTermination(5, TimeUnit.SECONDS);
      
        setMode("Node is drained", true);
    }
   
View Full Code Here

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

    pool.shutdown();
   
   
    // Wait for the finalization of the task
    try {
      pool.awaitTermination(1, TimeUnit.DAYS);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
   
    // Write a message to indicate the end of the program
View Full Code Here

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

                }
            });
        }

        executorService.shutdown();
        executorService.awaitTermination(2, TimeUnit.SECONDS);
        // check greater than so that it won't clash with concurrent executions of other tests in surefire
        assertThat(EfficientString.nextIndex()-startIndex, Matchers.greaterThan(total/factor));
    }

    public void shouldGetPrimitiveDefaultValues() {
View Full Code Here

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

      ep.submit(new SubscriptionGenerator(numSubscriptions/numThreads));
    }
    logger.info("event=started");
    try {
      ep.shutdown();
      ep.awaitTermination(60, TimeUnit.MINUTES);
    } catch (InterruptedException ex) {
      logger.error("event=failure", ex);
    }
    long end = System.currentTimeMillis();
    logger.info("event=done duration=" + (end-start));
View Full Code Here

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

    // Shutdown the pool
    threadPool.shutdown();

    // Wait for all the tasks to finish
    try {
      boolean stillRunning = !threadPool.awaitTermination(
          this.fileSplitTimeout, TimeUnit.MILLISECONDS);
      if (stillRunning) {
        threadPool.shutdownNow();
        // wait for the thread to shutdown completely.
        while (!threadPool.isTerminated()) {
View Full Code Here

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

                    // sample all resources with threadpool
                    final List<Future<HTTPSampleResult>> retExec = exec.invokeAll(liste);
                    // call normal shutdown (wait ending all tasks)
                    exec.shutdown();
                    // put a timeout if tasks couldn't terminate
                    exec.awaitTermination(AWAIT_TERMINATION_TIMEOUT, TimeUnit.SECONDS);

                    // add result to main sampleResult
                    for (Future<HTTPSampleResult> future : retExec) {
                        final HTTPSampleResult binRes = future.get();
                        res.addSubResult(binRes);
View Full Code Here

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

      threadPool.execute(r);
    }

    threadPool.shutdown();
    try {
      threadPool.awaitTermination(Integer.MAX_VALUE, TimeUnit.DAYS);
    } catch (InterruptedException e) {
      debug.println(1, "Evaluator error - result corrupted");
      e.printStackTrace();
    }
 
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.