Package java.util.concurrent

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


    ThreadPoolExecutor pool = new ThreadPoolExecutor(1, 10,
      5, TimeUnit.SECONDS,
      new SynchronousQueue<Runnable>(),
      Threads.newDaemonThreadFactory("test-hcm-delete"));

    pool.submit(new Runnable() {
      @Override
      public void run() {
        while (!Thread.interrupted()) {
          try {
            HConnection conn = HConnectionManager.getConnection(config);
View Full Code Here


          } catch (InterruptedException ie) { }
        }
      });
    }
    // First, add two tasks and make sure the pool size follows
    pool.submit(tasks.get(0));
    assertEquals(1, pool.getPoolSize());
    pool.submit(tasks.get(1));
    assertEquals(2, pool.getPoolSize());

    // Next, terminate those tasks and then make sure the pool is still the
View Full Code Here

      });
    }
    // First, add two tasks and make sure the pool size follows
    pool.submit(tasks.get(0));
    assertEquals(1, pool.getPoolSize());
    pool.submit(tasks.get(1));
    assertEquals(2, pool.getPoolSize());

    // Next, terminate those tasks and then make sure the pool is still the
    // same size
    queue.put(new Object());
View Full Code Here

    while (pool.getCompletedTaskCount() < 2) {
      Threads.sleep(1);
    }
    // Now let's simulate adding a RS meaning that we'll go up to three
    // concurrent threads. The pool should not grow larger than three.
    pool.submit(tasks.get(2));
    pool.submit(tasks.get(3));
    pool.submit(tasks.get(4));
    assertEquals(3, pool.getPoolSize());
    queue.put(new Object());
    queue.put(new Object());
View Full Code Here

      Threads.sleep(1);
    }
    // Now let's simulate adding a RS meaning that we'll go up to three
    // concurrent threads. The pool should not grow larger than three.
    pool.submit(tasks.get(2));
    pool.submit(tasks.get(3));
    pool.submit(tasks.get(4));
    assertEquals(3, pool.getPoolSize());
    queue.put(new Object());
    queue.put(new Object());
    queue.put(new Object());
View Full Code Here

    }
    // Now let's simulate adding a RS meaning that we'll go up to three
    // concurrent threads. The pool should not grow larger than three.
    pool.submit(tasks.get(2));
    pool.submit(tasks.get(3));
    pool.submit(tasks.get(4));
    assertEquals(3, pool.getPoolSize());
    queue.put(new Object());
    queue.put(new Object());
    queue.put(new Object());
  }
View Full Code Here


        ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(TEST_THREADS);
        executor.prestartAllCoreThreads();
        for (int i = 0; i < TEST_LOOPS; i++) {
            executor.submit(new SimulateTask());
        }


        for (int i = 0; i < 10; i++) {
            try {
View Full Code Here

          };

          if (executor == null) {
            r.run();
          } else {
            Future<?> result = executor.submit(r);
            results.add(result);
          }
        }

        if (executor != null) {
View Full Code Here

    reports.addAll(collectReports("reports-4.0", ReportProcessingMode.migration, errors));
    reports.addAll(collectReports("reports-4.0", ReportProcessingMode.current, errors));

    for (ExecuteReportRunner report : reports)
    {
      threadPool.submit(report);
    }

    threadPool.shutdown();
    while (threadPool.isTerminated() == false)
    {
View Full Code Here

            for (TokenRange range : masterRangeNodes)
            {
                if (jobRange == null)
                {
                    // for each range, pick a live owner and ask it to compute bite-sized splits
                    splitfutures.add(executor.submit(new SplitCallable(range, conf)));
                }
                else
                {
                    Range<Token> dhtRange = new Range<Token>(partitioner.getTokenFactory().fromString(range.start_token),
                                                             partitioner.getTokenFactory().fromString(range.end_token),
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.