Examples of awaitTermination()


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

    long end = System.currentTimeMillis() + milliseconds;
    for (Map.Entry<String, ThreadPoolExecutor> e:
        executors.entrySet()) {
      ThreadPoolExecutor executor = e.getValue();
      if (!executor.awaitTermination(
          Math.max(end - System.currentTimeMillis(), 0),
          TimeUnit.MILLISECONDS)) {
        LOG.warn("AsyncDiskService awaitTermination timeout.");
        return false;
      }
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 jsr166y.ForkJoinPool.awaitTermination()

    /*
     * Wait tasks termination (limit waiting to 15 minutes) and then display
     * processing state
     */
    boolean terminationState = taskExecutor.awaitTermination(15, TimeUnit.MINUTES);
    if (terminationState) {
      System.out.println("All tasks have finished their processing under the timeout !");
    } else {
      System.out.println("All tasks do not have finished their processing until the timeout !");
    }
View Full Code Here

Examples of net.pms.util.TaskRunner.awaitTermination()

          c.incr();
        }
      });
    }
    tk.shutdown();
    tk.awaitTermination(1, TimeUnit.DAYS);
    assertEquals("all 3 task is executed", 3, c.x);
  }

  @Test
  public void singletonTasks() throws InterruptedException {
View Full Code Here

Examples of org.apache.hadoop.util.AsyncDiskService.awaitTermination()

    }
    assertNotNull("Executing a task on a non-existing volume should throw an "
        + "Exception.", e);
   
    service.shutdown();
    if (!service.awaitTermination(5000)) {
      fail("AsyncDiskService didn't shutdown in 5 seconds.");
    }
   
    assertEquals(total, count);
  }
View Full Code Here

Examples of org.apache.http.impl.bootstrap.HttpServer.awaitTermination()

                .setExceptionLogger(new StdErrorExceptionLogger())
                .registerHandler("*", new HttpFileHandler(docRoot))
                .create();

        server.start();
        server.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);

        Runtime.getRuntime().addShutdownHook(new Thread() {
            @Override
            public void run() {
                server.shutdown(5, TimeUnit.SECONDS);
View Full Code Here

Examples of org.apache.http.impl.nio.bootstrap.HttpServer.awaitTermination()

                .setExceptionLogger(ExceptionLogger.STD_ERR)
                .registerHandler("*", new HttpFileHandler(docRoot))
                .create();

        server.start();
        server.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);

        Runtime.getRuntime().addShutdownHook(new Thread() {
            @Override
            public void run() {
                server.shutdown(5, TimeUnit.SECONDS);
View Full Code Here

Examples of org.apache.spark.streaming.api.java.JavaStreamingContext.awaitTermination()

        }
    });

    reducedStream.print();
    ssc.start();
    ssc.awaitTermination();
  }
}
View Full Code Here

Examples of org.apache.tomcat.util.threads.ThreadPoolExecutor.awaitTermination()

                ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor;
                tpe.shutdownNow();
                long timeout = getExecutorTerminationTimeoutMillis();
                if (timeout > 0) {
                    try {
                        tpe.awaitTermination(timeout, TimeUnit.MILLISECONDS);
                    } catch (InterruptedException e) {
                        // Ignore
                    }
                    if (tpe.isTerminating()) {
                        getLog().warn(sm.getString("endpoint.warn.executorShutdown", getName()));
View Full Code Here

Examples of org.glassfish.hk2.classmodel.reflect.Parser.awaitTermination()

                            if (libAdapter!=null) {
                                libAdapter.close();
                            }
                        }
                    }
                    parser.awaitTermination();
                    scannerAdapter.close();
                    context.addTransientAppMetaData(Types.class.getName(), parsingContext.getTypes());
                    context.addTransientAppMetaData(Parser.class.getName(), parser);
                    return parsingContext.getTypes();
                } catch(InterruptedException 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.