Package java.util.concurrent

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


  public static void initPool(String poolName, int corePoolSize,
      int maximumPoolSize, int keepAliveTime, TimeUnit timeUnit) {
    ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) poolMap.get(poolName);
    if(threadPoolExecutor!=null) {
      logger.log(Level.FINE, "{0} will be shutdown and re-created", poolName);
      threadPoolExecutor.shutdown();
    }
    threadPoolExecutor = new ThreadPoolExecutor(corePoolSize,
        maximumPoolSize, keepAliveTime, timeUnit,
        new LinkedBlockingQueue<Runnable>());
    NamedThreadFactory threadFactory = new NamedThreadFactory("Thread_Pool_"+poolName);
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

                try {
                    // 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) {
View Full Code Here

        shutdownHub.addRegistryShutdownListener(new RegistryShutdownListener()
        {
            public void registryDidShutdown()
            {
                executorService.shutdown();
            }
        });

        return new ParallelExecutorImpl(executorService, thunkCreator, perthreadManager);
    }
View Full Code Here

      };
     
      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

        // Wait for file to be processed.
        try {
            allBadKeysReadLatch.await();

            badKeyReaderService.shutdown();
            consistencyFixWorkers.shutdown();
        } catch(InterruptedException e) {
            e.printStackTrace();
            fail("Unexpected exception");
        }
        consistencyFix.close();
View Full Code Here

        // atomic bulkloads assuming that there are splits and no merges, and
        // that we can atomically pull out the groups we want to retry.
      }

    } finally {
      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

        processorCache.clear();
        if ( executor!=null ) {
            if ( executor instanceof ThreadPoolExecutor ) {
                //this is our internal one, so we need to shut it down
                ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor;
                tpe.shutdown();
                TaskQueue queue = (TaskQueue) tpe.getQueue();
                queue.setParent(null,null);
            }
            executor = null;
        }
View Full Code Here

        tpe.execute(new FSRegionScanner(fs, regionPath,
            regionToBestLocalityRSMapping, regionDegreeLocalityMapping));
      }
    } finally {
      tpe.shutdown();
      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
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.