Package java.util.concurrent

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


        throws InterruptedException {
        FutureTask<?> client = new FutureTask<Object>(clientImpl, null);
        ThreadPoolExecutor tpe = new ThreadPoolExecutor(1, 1, 10000L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<Runnable>());
        tpe.execute(client);
        tpe.shutdown();
        tpe.awaitTermination(timeOut, timeUnit);
        if (!client.isDone()) {
            return false;
        }
        return true;
View Full Code Here


    Map<String, Object> cache = new HashMap<String, Object>();
    ThreadPoolBuilder builder = new ThreadPoolBuilder(name.getTableNameString(), new Configuration(false));
    ThreadPoolExecutor exec = ThreadPoolManager.getExecutor(builder, cache);
    assertNotNull("Got a null exector from the pool!", exec);
    //shutdown the pool and ensure that it actually shutdown
    exec.shutdown();
    ThreadPoolExecutor exec2 = ThreadPoolManager.getExecutor(builder, cache);
    assertFalse("Got the same exectuor, even though the original shutdown", exec2 == exec);
  }

  @Test
View Full Code Here

    ThreadPoolExecutor exec2 = ThreadPoolManager.getExecutor(builder, cache);
    assertTrue("Should have gotten the same executor", exec2 == exec);
    exec.shutdown();
    assertFalse("Executor is shutting down, even though we have a live reference!",
      exec.isShutdown() || exec.isTerminating());
    exec2.shutdown();
    // wait 5 minutes for thread pool to shutdown
    assertTrue("Executor is NOT shutting down, after releasing live reference!",
      exec.awaitTermination(300, TimeUnit.SECONDS));
  }
View Full Code Here

              } catch (ExecutionException e) {
                throw new IOException(e);
              }
            } while (!executorDone);
          }
          executor.shutdown();
        }
        HiveInterruptUtils.checkInterrupted();
        for (Map.Entry<String, ContentSummary> entry : resultMap.entrySet()) {
          ContentSummary cs = entry.getValue();
View Full Code Here

        log.debug("executors that finished: " + executor.getCompletedTaskCount());
        log.debug("Number of Executors alive: " + counter.value());
        sleep();
      }
    } finally {
      executor.shutdown();
    }
  }

  private void sleep() {
    try {
View Full Code Here

      //splitStoreFile(sf, splitdir);
      StoreFileSplitter sfs = new StoreFileSplitter(sf, splitdir);
      futures.add(threadPool.submit(sfs));
    }
    // Shutdown the pool
    threadPool.shutdown();

    // Wait for all the tasks to finish
    try {
      boolean stillRunning = !threadPool.awaitTermination(
          this.fileSplitTimeout, TimeUnit.MILLISECONDS);
View Full Code Here

        if(bulkToken != null) {
          new SecureBulkLoadClient(table).cleanupBulkLoad(bulkToken);
        }
      }
      pool.shutdown();
      if (queue != null && !queue.isEmpty()) {
        StringBuilder err = new StringBuilder();
        err.append("-------------------------------------------------\n");
        err.append("Bulk load aborted with some files not yet loaded:\n");
        err.append("-------------------------------------------------\n");
View Full Code Here

      //splitStoreFile(sf, splitdir);
      StoreFileSplitter sfs = new StoreFileSplitter(sf, splitdir);
      futures.add(threadPool.submit(sfs));
    }
    // Shutdown the pool
    threadPool.shutdown();

    // Wait for all the tasks to finish
    try {
      boolean stillRunning = !threadPool.awaitTermination(
          this.fileSplitTimeout, TimeUnit.MILLISECONDS);
View Full Code Here

      //splitStoreFile(sf, splitdir);
      StoreFileSplitter sfs = new StoreFileSplitter(sf, splitdir);
      futures.add(threadPool.submit(sfs));
    }
    // Shutdown the pool
    threadPool.shutdown();

    // Wait for all the tasks to finish
    try {
      boolean stillRunning = !threadPool.awaitTermination(
          this.fileSplitTimeout, TimeUnit.MILLISECONDS);
View Full Code Here

                boolean tasksCompleted = false;
                try {
                    // sample all resources with threadpool
                    final List<Future<AsynSamplerResultHolder>> 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);
                    CookieManager cookieManager = getCookieManager();
                    // add result to main sampleResult
                    for (Future<AsynSamplerResultHolder> future : retExec) {
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.