Package java.util.concurrent

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


      threadsList.add( searcherThread );
      threadPool.execute( searcherThread );
    }
    threadPool.shutdown();//required to enable awaitTermination functionality
    startSignal.countDown();//start all created threads
    boolean terminationOk = threadPool.awaitTermination( 60, TimeUnit.SECONDS );
    if ( terminationOk==false ) {
      System.out.println( "No enough time to complete the tests!" );
      return 0;
    }
    long totalTime = 0;
View Full Code Here


    for ( int i = 0; i < SEARCHES_NUM; i++ ) {
      executor.execute( makeTask( i ) );
    }
    executor.shutdown();
    startSignal.countDown();
    executor.awaitTermination( 500, TimeUnit.SECONDS );
    assertTrue( "memory leak: holding a reference to some unused IndexReader", readerProvider.areAllOldReferencesGone() );
    for ( MockIndexReader reader : readerProvider.getCreatedIndexReaders() ) {
      if ( readerProvider.isReaderCurrent( reader ) ) {
        assertTrue( "the most current reader should be open", ! reader.isClosed() );
      }
View Full Code Here

    ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool( WORKER_THREADS );
    for (int batch=0; batch<=5000000; batch++){
      executor.execute( filler );
    }
    executor.shutdown();
    executor.awaitTermination( 600, TimeUnit.SECONDS );
    iw.commit();
    iw.optimize();
    iw.close();
    System.out.println( "Index created." );
  }
View Full Code Here

        executor.execute( updateTask );
    }
    executor.shutdown();
    long startTime = System.currentTimeMillis();
    startSignal.countDown();//start!
    executor.awaitTermination( 600, TimeUnit.SECONDS );
    long endTime = System.currentTimeMillis();
    System.out.println( "Performance test for " + getReaderStrategyName() + ": " + (endTime - startTime) +"ms. (" +
        (TOTAL_WORK_BATCHES*SEARCHERS_PER_BATCH) + " searches, " +
        (TOTAL_WORK_BATCHES*INSERTIONS_PER_BATCH) + " insertions, " +
        (TOTAL_WORK_BATCHES*UPDATES_PER_BATCH) + " updates)" );
View Full Code Here

      executor.shutdown();
      Thread.sleep(5000);
      int putsAfter5Seconds = stats.succesfullPutsCounter.get();
      System.out.println("\nSituation after 5 seconds:");
      System.out.println(stats.toString());
      executor.awaitTermination(STRESS_TIME_MINUTES, TimeUnit.MINUTES);
      stats.globalQuit = true;
      executor.awaitTermination(10, TimeUnit.SECONDS); // give some time to awake and quit
      executor.shutdownNow();
      System.out.println("\nFinal situation:");
      System.out.println(stats.toString());
View Full Code Here

      int putsAfter5Seconds = stats.succesfullPutsCounter.get();
      System.out.println("\nSituation after 5 seconds:");
      System.out.println(stats.toString());
      executor.awaitTermination(STRESS_TIME_MINUTES, TimeUnit.MINUTES);
      stats.globalQuit = true;
      executor.awaitTermination(10, TimeUnit.SECONDS); // give some time to awake and quit
      executor.shutdownNow();
      System.out.println("\nFinal situation:");
      System.out.println(stats.toString());
      assert !stats.seenFailures : "at least one thread has seen unexpected state";
      assert stats.succesfullPutsCounter.get() > 0 : "the lock should have been taken at least once";
View Full Code Here

      int threadWakeFrequency = conf.getInt(HConstants.THREAD_WAKE_FREQUENCY,
          60 * 1000);
      try {
        // here we wait until TPE terminates, which is either naturally or by
        // exceptions in the execution of the threads
        while (!tpe.awaitTermination(threadWakeFrequency,
            TimeUnit.MILLISECONDS)) {
          // printing out rough estimate, so as to not introduce
          // AtomicInteger
          LOG.info("Locality checking is underway: { Scanned Regions : "
              + tpe.getCompletedTaskCount() + "/"
View Full Code Here

    Date start,end;
    start=new Date();
    executor.execute(task);
    executor.shutdown();
    try {
      executor.awaitTermination(1, TimeUnit.DAYS);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    end=new Date();
    System.out.printf("Main: Executor: %d\n",(end.getTime()-start.getTime()));
View Full Code Here

   
    /*
     * Wait for the finalization of the executor
     */
    try {
      executor.awaitTermination(1, TimeUnit.DAYS);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
   
    /*
 
View Full Code Here

      Task task=new Task();
      executor.execute(task);
    }
    executor.shutdown();
    try {
      executor.awaitTermination(1, TimeUnit.DAYS);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    end=new Date();
    System.out.printf("Main: Executor: %d\n",(end.getTime()-start.getTime()));
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.