Package java.util.concurrent

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


                    futures = new ArrayList<Future<Number>>();
        UpdateExecutor call = new UpdateExecutor();
        call.executor = ex;
        call.query = qs.next();
        call.params = params;
        futures.add(threadPool.submit(call));
      }
      for (Future<Number> future : futures) {
        try {
          Number n = future.get();
                    result += (n == null) ? 0 : n.intValue();
View Full Code Here


      mr = new MiniMRCluster(taskTrackers, "file:///", 1, null, null, new JobConf(conf));
      final MiniMRCluster finalMR = mr;
      ExecutorService exec = Executors.newFixedThreadPool(NUM_THREADS);
      List<Future<Void>> futures = new ArrayList<Future<Void>>(NUM_THREADS);
      for (int i = 0; i < NUM_THREADS; i++) {
        futures.add(exec.submit(new Callable<Void>() {
          public Void call() throws Exception {
            JobConf jobConf = finalMR.createJobConf();
            runSleepJob(jobConf);
            return null;
          }
View Full Code Here

                call.executor = executors.get(i);
                call.query = owner._queries.get(i);
                call.params = params;
                call.range = range;
        usedExecutors.add(call.executor);
                futures.add(threadPool.submit(call));
      }
      for (Future<ResultObjectProvider> future : futures) {
        try {
          rops.add(future.get());
        } catch (InterruptedException e) {
View Full Code Here

       
        DeleteExecutor call = new DeleteExecutor();
        call.executor = executors.get(i);
        call.query = owner._queries.get(i);
        call.params = params;
        futures.add(threadPool.submit(call));
      }
      for (Future<Number> future : futures) {
        try {
          Number n = future.get();
          if (n != null)
View Full Code Here

                    futures = new ArrayList<Future<Number>>();
        UpdateExecutor call = new UpdateExecutor();
        call.executor = ex;
        call.query = qs.next();
        call.params = params;
        futures.add(threadPool.submit(call));
      }
      for (Future<Number> future : futures) {
        try {
          Number n = future.get();
                    result += (n == null) ? 0 : n.intValue();
View Full Code Here

                QueryExecutor call = new QueryExecutor();
                call.executor = executor;
                call.query = query;
                call.params = params;
                call.range = range;
                futures.add(threadPool.submit(call));
      }
      for (Future<ResultObjectProvider> future : futures) {
        try {
          rops.add(future.get());
        } catch (InterruptedException e) {
View Full Code Here

      ExecutorService executor = Executors.newFixedThreadPool(NUMBER_OF_THREADS);

      for (int thread = 0; thread < NUMBER_OF_THREADS; thread++) {

         executor.submit(new Runnable() {

            @Override
            public void run()
            {
View Full Code Here

        TestLS.intervalTime = 0L;
        TestLS.measurementTime = 0L;

        // Mostly we're just testing that we don't get an exception.
        // We use a separate thread so that we can stop it after the test.
        es.submit(new Runnable() {
            public void run() {
                LoadSensorManager.main(args);
            }
        });
View Full Code Here

        assert drain != null;
        final BlockingQueue<Pair> queue = new SynchronousQueue<Pair>();
        final FileSystem fs = FileSystem.get(conf);
        ExecutorService executor = Executors.newFixedThreadPool(1);
        try {
            Future<Void> fetcher = executor.submit(new Callable<Void>() {
                @Override
                public Void call() throws Exception {
                    fetch(fs, paths, queue);
                    queue.put(Pair.eof());
                    return null;
View Full Code Here

      // Get handle to service to run object in thread.
      ExecutorService executor = Executors.newSingleThreadExecutor();

      // Run object in thread and return Future.
      return executor.submit(operation);
   }

   /**
    * End of test report run. Called at the end of a test run. If verbose is set
    * to true reads all suites in the suite list and prints out a descriptive
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.